Add and fix compiler warnings (#718)
* Add and remove compiler warning compile options
Add some new compiler warnings. Some of those does not build clean so
ignore them for now. This also helps if some user use those options so
we ignore those for them also.
Also remove following ignores as they do not produce any warnings:
- Wno-attributes
- Wno-long-long
- Wno-implicit-fallthrough
* Fix -Wmissing-declarations compiler warnings
Fix new -Wmissing-declarations compiler warnings. I tried to look which
should be in headers and which should be static. Might be that some
statics should be in header as it is not easy to choose if something
should be exported or not.
* Fix -Wmissing-field-initializers compiler warnings
If we use { { 0 } } compiler thinks we might have mean that we only
meant initialize first member of struct or have forgotton to add second
one. We could do { { 0 }, 0 } but we can just do { 0 } which tells
compiler that hey just intialize this whole thing to zero.
* tests: Fix couple -Wfloat-conversion warnings
Add f prefix to floating point numbers to get some double to float
warnings away.
* ci: Make warnings as errors with cmake main build
To keep repo more clean from warnings use Werror flag when building main
project.
Windows should need -DCMAKE_C_FLAGS="/WX" but we have not ignore errors
for that yet so let's not yet take it in use.
* ci: Build also tests in matrix build
Enable also tests to be builded in our main matrix build. This way tests
will be builded also with clang and in future also with MSVC. We also
keep build very clean now as all warnings as catched.
With this we can also take out -Werror from compile_options as we add
that in CI. It is not good practice to keep that option always on. It
makes development lot harder. See example this blog post [1].
[1]: https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/
* getevent: Deprecate getevent_encode_apdu()
Steve suggested that we should deprecate getevent_encode_apdu() [1].
Suggested-by: Steve Karg
[1]: https://github.com/bacnet-stack/bacnet-stack/pull/718#discussion_r1715821735
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
@@ -95,6 +95,14 @@ extern "C" {
|
||||
uint32_t instance,
|
||||
char *new_name);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Analog_Input_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Reliability_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Analog_Input_Units_Set(
|
||||
uint32_t instance,
|
||||
|
||||
@@ -524,11 +524,11 @@ bool bacfile_read_only_set(
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, return the flag
|
||||
* @brief
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return true if the property is true
|
||||
* @param bdatetime
|
||||
*/
|
||||
void bacfile_modification_date(
|
||||
static void bacfile_modification_date(
|
||||
uint32_t object_instance, BACNET_DATE_TIME *bdatetime)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -151,6 +151,13 @@ extern "C" {
|
||||
void Binary_Input_Write_Present_Value_Callback_Set(
|
||||
binary_input_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Input_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Input_Write_Disable(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Binary_Input_Create(
|
||||
uint32_t object_instance);
|
||||
|
||||
@@ -110,6 +110,16 @@ extern "C" {
|
||||
bool Binary_Value_Present_Value_Set(
|
||||
uint32_t instance,
|
||||
BACNET_BINARY_PV value);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Present_Value_Callback_Set(
|
||||
binary_value_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Write_Enabled(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Enable(uint32_t instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Binary_Value_Write_Disable(uint32_t instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Value_Out_Of_Service(
|
||||
|
||||
@@ -79,6 +79,9 @@ extern "C" {
|
||||
bool Multistate_Input_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
void Multistate_Input_Write_Present_Value_Callback_Set(
|
||||
multistate_input_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Multistate_Input_Change_Of_Value(
|
||||
|
||||
@@ -78,6 +78,9 @@ extern "C" {
|
||||
bool Multistate_Value_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
uint32_t value);
|
||||
BACNET_STACK_EXPORT
|
||||
void Multistate_Value_Write_Present_Value_Callback_Set(
|
||||
multistate_value_write_present_value_callback cb);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Multistate_Value_Change_Of_Value(
|
||||
@@ -127,6 +130,14 @@ extern "C" {
|
||||
uint32_t object_instance,
|
||||
uint32_t state_index);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELIABILITY Multistate_Value_Reliability(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Multistate_Value_Reliability_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_RELIABILITY value);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Multistate_Value_Create(
|
||||
uint32_t object_instance);
|
||||
|
||||
@@ -3033,7 +3033,7 @@ bool Network_Port_MSTP_Max_Info_Frames_Set(
|
||||
* @param object_property [in] BACnet object property
|
||||
* @return true if the object property is a BACnetARRAY datatype
|
||||
*/
|
||||
bool Network_Port_BACnetArray_Property(BACNET_PROPERTY_ID object_property)
|
||||
static bool Network_Port_BACnetArray_Property(BACNET_PROPERTY_ID object_property)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
|
||||
@@ -76,6 +76,12 @@ Structured_View_Subordinate_List(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
void Structured_View_Subordinate_List_Set(
|
||||
uint32_t object_instance, BACNET_SUBORDINATE_DATA *subordinate_list);
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_SUBORDINATE_DATA *
|
||||
Structured_View_Subordinate_List_Member(
|
||||
uint32_t object_instance, BACNET_ARRAY_INDEX array_index);
|
||||
BACNET_STACK_EXPORT
|
||||
unsigned int Structured_View_Subordinate_List_Count(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_RELATIONSHIP
|
||||
@@ -84,6 +90,19 @@ BACNET_STACK_EXPORT
|
||||
bool Structured_View_Default_Subordinate_Relationship_Set(
|
||||
uint32_t object_instance, BACNET_RELATIONSHIP relationship);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Structured_View_Subordinate_List_Element_Encode(
|
||||
uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu);
|
||||
BACNET_STACK_EXPORT
|
||||
int Structured_View_Subordinate_Annotations_Element_Encode(
|
||||
uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu);
|
||||
BACNET_STACK_EXPORT
|
||||
int Structured_View_Subordinate_Node_Types_Element_Encode(
|
||||
uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu);
|
||||
BACNET_STACK_EXPORT
|
||||
int Structured_View_Subordinate_Relationships_Element_Encode(
|
||||
uint32_t object_instance, BACNET_ARRAY_INDEX array_index, uint8_t *apdu);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_DEVICE_OBJECT_REFERENCE *
|
||||
Structured_View_Represents(uint32_t object_instance);
|
||||
|
||||
@@ -72,7 +72,7 @@ BACNET_STACK_EXPORT
|
||||
bool Time_Value_Out_Of_Service_Set(uint32_t object_instance, bool oos_flag);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Time_Description(uint32_t object_instance);
|
||||
char *Time_Value_Description(uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Time_Value_Description_Set(uint32_t object_instance, char *new_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user