Bugfix/code clean using gcc warnings (#371)

* Enable extra GCC warnings to discover subtle bugs

* convert c++ comments to c comments

* cleanup pedantic compiler warnings

* Compile apps with GNU89 GNU99 GNU11 and GNU17

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-12-25 21:43:51 -06:00
committed by GitHub
parent 0728bc4390
commit b91735af13
66 changed files with 990 additions and 847 deletions
+11 -10
View File
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h> /* for time */
#ifdef __STDC_ISO_10646__
#if (__STDC_VERSION__ >= 199901L) && defined (__STDC_ISO_10646__)
#include <locale.h>
#endif
#include <errno.h>
@@ -587,7 +587,7 @@ static void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
if (object_type == OBJECT_DATETIME_VALUE) {
break; /* A special case - no braces for this pair */
}
/* Else, fall through to normal processing. */
BACNET_STACK_FALLTHROUGH();
default:
/* Normal array: open brace */
fprintf(stdout, "{ ");
@@ -747,7 +747,7 @@ static void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
fprintf(stdout, "?");
break;
}
/* Else, fall through for normal processing. */
BACNET_STACK_FALLTHROUGH();
case PROP_DAYLIGHT_SAVINGS_STATUS:
case PROP_LOCAL_TIME:
case PROP_LOCAL_DATE: /* Only if !ShowValues */
@@ -760,7 +760,7 @@ static void PrintReadPropertyData(BACNET_OBJECT_TYPE object_type,
fprintf(stdout, "?");
break;
}
/* Else, fall through and print value: */
BACNET_STACK_FALLTHROUGH();
default:
bacapp_print_value(stdout, &object_value);
break;
@@ -895,6 +895,8 @@ static uint8_t Read_Properties(
case PROP_SUBORDINATE_LIST:
IsLongArray = true;
break;
default:
break;
}
}
invoke_id = Send_Read_Property_Request(device_instance, pMyObject->type,
@@ -1016,6 +1018,7 @@ static void print_usage(char *filename)
static void print_help(char *filename)
{
(void)filename;
printf("Generates Full EPICS file, including Object and Property List\n");
printf("device-instance:\n"
"BACnet Device Object Instance number that you are\n"
@@ -1120,10 +1123,9 @@ static int CheckCommandLineArgs(int argc, char *argv[])
} else {
printf("ERROR: invalid Target MAC %s \n", argv[i]);
}
/* And fall through to print_usage */
/* fall through to print_usage */
}
/* Either break or fall through, as above */
/* break; */
BACNET_STACK_FALLTHROUGH();
default:
print_usage(filename);
exit(0);
@@ -1462,7 +1464,7 @@ int main(int argc, char *argv[])
address_init();
Init_Service_Handlers();
dlenv_init();
#ifdef __STDC_ISO_10646__
#if (__STDC_VERSION__ >= 199901L) && defined (__STDC_ISO_10646__)
/* Internationalized programs must call setlocale()
* to initiate a specific language operation.
* This can be done by calling setlocale() as follows.
@@ -1581,8 +1583,7 @@ int main(int argc, char *argv[])
Print_Device_Heading();
}
myState = GET_ALL_REQUEST;
/* Fall through now */
BACNET_STACK_FALLTHROUGH();
case GET_ALL_REQUEST:
case GET_LIST_OF_ALL_REQUEST:
/* "list" differs in ArrayIndex only */