Comments (7)
What configuration you use? Can you include some of the errors you see? I've just built host+controller with -std=c99
without errors...
from mynewt-nimble.
I'm using gcc 5.4.0 with -Werror -std=c99 -pedantic-errors
. I'm seeing warnings as errors, ISO C99 issues, and pedantic errors in nimble preventing integration with these compiler flags.
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Here are some example errors:
gcc -DHAVE_CONFIG_H -I. -I../../../include -fPIC -I../../../include -I../../../examples/platforms -I../../../src/core -I../../../src/lib -D_GNU_SOURCE -I../../../third_party/mynewt-nimble/repo/porting/npl/linux/include -I../../../third_party/mynewt-nimble/repo/porting/npl/linux/src -I../../../third_party/mynewt-nimble/repo/porting/nimble/include -I../../../third_party/mynewt-nimble/repo/nimble/include -I../../../third_party/mynewt-nimble/repo/nimble/host/include -I../../../third_party/mynewt-nimble/repo/nimble/host/src -I../../../third_party/mynewt-nimble/repo/nimble/host/services/ans/include -I../../../third_party/mynewt-nimble/repo/nimble/host/services/gap/include -I../../../third_party/mynewt-nimble/repo/nimble/host/services/gatt/include -I/home/mturon/src_local/nest/openthread/ot-nimble/third_party/mbedtls -I/home/mturon/src_local/nest/openthread/ot-nimble/third_party/mbedtls/repo/include -I/home/mturon/src_local/nest/openthread/ot-nimble/third_party/mbedtls/repo/include/mbedtls -DMBEDTLS_CONFIG_FILE=\"mbedtls-config.h\" -g -O2 -Wall -Wextra -Wshadow -Werror -std=c99 -pedantic-errors -D_BSD_SOURCE=1 -D_DEFAULT_SOURCE=1 -MT libopenthread_posix_a-ble_nimble.o -MD -MP -MF .deps/libopenthread_posix_a-ble_nimble.Tpo -c -o libopenthread_posix_a-ble_nimble.o `test -f 'ble_nimble.c' || echo './'`ble_nimble.c
In file included from ../../../third_party/mynewt-nimble/repo/porting/nimble/include/os/os.h:53:0,
from ../../../third_party/mynewt-nimble/repo/nimble/include/nimble/ble.h:26,
from ble_nimble.c:37:
../../../third_party/mynewt-nimble/repo/porting/nimble/include/os/os_mbuf.h:107:13: error: ISO C forbids zero-size array ‘om_databuf’ [-Wpedantic]
uint8_t om_databuf[0];
^
In file included from ../../../third_party/mynewt-nimble/repo/porting/nimble/include/os/os.h:54:0,
from ../../../third_party/mynewt-nimble/repo/nimble/include/nimble/ble.h:26,
from ble_nimble.c:37:
../../../third_party/mynewt-nimble/repo/porting/nimble/include/os/os_mempool.h:71:29: error: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
SLIST_HEAD(,os_memblock);
^
In file included from ble_nimble.c:37:0:
../../../third_party/mynewt-nimble/repo/nimble/include/nimble/ble.h:105:6: error: ISO C99 doesn’t support unnamed structs/unions [-Wpedantic]
};
^
In file included from ../../../third_party/mynewt-nimble/repo/nimble/host/include/host/ble_hs.h:30:0,
from ble_nimble.c:38:
../../../third_party/mynewt-nimble/repo/nimble/include/nimble/hci_common.h:910:46: error: ISO C forbids zero-size array ‘params’ [-Wpedantic]
struct hci_le_subev_direct_adv_rpt_param params[0];
^
In file included from ../../../third_party/mynewt-nimble/repo/nimble/host/include/host/ble_hs_adv.h:24:0,
from ../../../third_party/mynewt-nimble/repo/nimble/host/include/host/ble_gap.h:32,
from ../../../third_party/mynewt-nimble/repo/nimble/host/include/host/ble_hs.h:33,
from ble_nimble.c:38:
../../../third_party/mynewt-nimble/repo/nimble/host/include/host/ble_uuid.h:95:33: error: ISO C does not permit named variadic macros [-Wvariadic-macros]
#define BLE_UUID128_INIT(uuid128...) \
^
../../../third_party/mynewt-nimble/repo/nimble/host/include/host/ble_uuid.h:107:36: error: ISO C does not permit named variadic macros [-Wvariadic-macros]
#define BLE_UUID128_DECLARE(uuid128...) \
^
from mynewt-nimble.
Anonymous structs and unions were added in C11. I agree that conforming to an older specification improves portability, but C11 is already seven years old! :)
from mynewt-nimble.
@ccollins476ad I can look into pushing the project I'm integrating into up to -std=c11
, but what are your thoughts on being able to pass -Werror
and -pedantic-errors
?
from mynewt-nimble.
I think achieving ISO C compliance will be quite a challenge. The nimble codebase knowingly uses quite a few gcc/clang-isms (e.g., __attribute__((packed))
).
Standards conformance is certainly a good thing, but it was not viewed as a requirement when nimble was being developed. So, in my opinion, it is not worth the effort required at this point. Of course, it all depends on whether and why someone needs nimble to be standards compliant.
from mynewt-nimble.
@ccollins476ad I think it is always better to be C99 compliant. I already had a lot of pthread issues which were solved by strict C99 compliant code and compiler usage. I heard the same by other experiences embedded software developer. They all are developing in strict C99 standard.
from mynewt-nimble.
There's no point in regressing to strict C99 when we have C11.
from mynewt-nimble.
Related Issues (20)
- Where can I find the documentation for nimble-1.4.0 and nimble-1.3.0? HOT 2
- Linux unit test: Segmentation fault HOT 8
- Runnig blecent app on Linux does not work HOT 4
- Host HCI commands not freed HOT 2
- Determine if BLE_GATT_ACCESS_OP_READ_CHR is a long read. HOT 1
- Occasional connection supervision timeout on DLE update HOT 2
- reserved identifier violation HOT 1
- Where can I find documentation for known vulnerabilities
- NimBLE supports to disable BLE GATT client or server HOT 1
- NimBLE sample build error with apache-mynewt-core HOT 1
- Broken Link HOT 1
- How to trace function calls in controller code
- Document NimBLE Vendor specific HCI commands and events
- Is it possible to run Nimble auto-pts on linux? HOT 1
- Reducing MSYS_1_BLOCK_SIZE breaks SC Pairing DH key exchange HOT 4
- nimble-linux: ble_hci_sock_init: Assertion `rc == 0' failed. HOT 4
- Ability for ble_gatts_notify_custom() to wait for new packet buffers
- Change Macro from min to MIN in lpn.c
- controller/iso: ISO broadcast support without encryption HOT 1
- Error code of ble_gap_adv_set_data function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mynewt-nimble.