Bugfix/c89 compile fixes (#327)

* Fix code to be able to compile with older C89 ANSI compilers

* Convert C++ comments to C89 comments.

* default to std=gnu89

* Fix to enable CMake 3.1 to build on Centos7

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
This commit is contained in:
Steve Karg
2022-08-23 13:37:32 -05:00
committed by GitHub
parent 065d0334ee
commit 95b487ea6f
16 changed files with 85 additions and 56 deletions
+2 -2
View File
@@ -96,9 +96,9 @@ BACNET_SRC_DIR = $(realpath ../src)
# Compiler flag to set the C Standard level.
# c89 - "ANSI" C
# gnu89 - c89 plus GCC extensions
# c99 - ISO C99 standard (not yet fully implemented)
# c99 - ISO C99 standard
# gnu99 - c99 plus GCC extensions
CSTANDARD = -std=gnu99
CSTANDARD = -std=gnu89
#build for release (default) or debug
OPTIMIZATION ?= -Os
+1 -1
View File
@@ -189,7 +189,7 @@ bool dl_ip_init(ROUTER_PORT *port, IP_DATA *ip_data)
/* bind the socket to the local port number */
sin.sin_family = AF_INET;
// sin.sin_addr.s_addr, ip_data->local_addr.s_addr;// = htonl(INADDR_ANY);
/* sin.sin_addr.s_addr, ip_data->local_addr.s_addr;// = htonl(INADDR_ANY); */
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port = ip_data->port;
+3 -3
View File
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
}
}
// blocking dequeue here
/* blocking dequeue here */
bacmsg = recv_from_msgbox(head->main_id, &msg_storage, 0);
if (bacmsg) {
switch (bacmsg->type) {
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
break;
}
// print_msg(bacmsg);
/* print_msg(bacmsg); */
if (is_network_msg(bacmsg)) {
buff_len =
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
msg_storage.type = DATA;
msg_storage.data = msg_data;
// print_msg(bacmsg);
/* print_msg(bacmsg); */
if (is_network_msg(bacmsg)) {
msg_data->ref_count = 1;