Force C89/C90 compatible and for test C99 (#722)

* bacint: Do not use ULL suffix

For sake of be more compatible with C89/C90 let's not use ULL at all.
Overall conversion functions are lot cleaner now. Only idiotic thing is
in bacnet_unsigned_length() where we need to do shift. There is probably
better way to do that but could not come up any at resonable time.

* Force C89/C90 and for tests C99

bacnet-stack seems to be all compatible with C89/C90. This is probably
design choice. Let's force this in CMake so no one will break that by
accident.

In tests we are using some C99 features already. Let's not be to strict
about those as those are "just tests".

* Fix -Wdeclaration-after-statement warnings

To make code C89/C90 compatible fix -Wdeclaration-after-statement
warnings.

We got like following warning without this change.

```C
bacnet-stack/apps/epics/main.c:293:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement
  293 |     uint32_t Object_Instance;
      |     ^~~~~~~~
```

* cmake: Add -Wno-c99-extensions compiler option

Clang does not like _Bool which is used in stdbool.h files. For now
let's just ignore this. We could define that differently but let's think
that another time. Now goal is to get warning free CI with more code to
be builded in there.

* cmake: Add -Wno-long-long compiler option for apple

Apple seems to do stupid things with their system header. There is
UINT64_MAX with ULL suffix and not like in Linux and Windows

  __UINT64_C(18446744073709551615)

For this reason we need to ignore Wlong-long for it.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
Kari Argillander
2024-08-15 15:23:04 +03:00
committed by GitHub
parent c1195dd8a0
commit 40c5570d64
5 changed files with 117 additions and 120 deletions
+1 -2
View File
@@ -518,8 +518,7 @@ int bip_get_local_netmask(struct in_addr *netmask)
if (ifname == NULL)
ifname = "en0";
printf("ifname %s", ifname);
char *request = "netmask";
rv = get_local_address(ifname, netmask, request);
rv = get_local_address(ifname, netmask, "netmask");
return rv;
}