Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v1.14-branch] C++: fix builds with non-Zephyr toolchain #18552

Merged
merged 3 commits into from
Sep 25, 2019

Commits on Aug 21, 2019

  1. subsys/testsuite: rearrange for standard use of extern "C"

    Consistently place C++ use of extern "C" after all include directives,
    within the negative branch of _ASMLANGUAGE if used.
    
    Background from issue zephyrproject-rtos#17997:
    
    Declarations that use C linkage should be placed within extern "C"
    so the language linkage is correct when the header is included by
    a C++ compiler.
    
    Similarly #include directives should be outside the extern "C" to
    ensure the language-specific default linkage is applied to any
    declarations provided by the included header.
    
    Backport: c0d3397
    See: https://en.cppreference.com/w/cpp/language/language_linkage
    Signed-off-by: Peter Bigot <[email protected]>
    pabigot committed Aug 21, 2019
    Configuration menu
    Copy the full SHA
    880093e View commit details
    Browse the repository at this point in the history
  2. lib/newlib: revert treatment of libc files as system includes

    The solution from zephyrproject-rtos#14312 of using -isystem to prioritize the position of
    the libc directory bypasses the effect of -ffreestanding with respect to
    libc symbols expected to be present in a non-hosted environment.
    
    Further, it breaks C++ with the ARM Embedded toolchain as the system
    fails to find the right file with #include_next.
    
    Use a more fine-grained solution that explicitly includes the underlying
    newlib header required for <inttypes.h> support before moving on to
    include the next available one, whether system or non-system.
    
    Closes zephyrproject-rtos#17564
    
    Backport: 96c1b05
    Signed-off-by: Peter Bigot <[email protected]>
    pabigot committed Aug 21, 2019
    Configuration menu
    Copy the full SHA
    081b7cc View commit details
    Browse the repository at this point in the history
  3. tests: add C++ 17 standard library test

    Confirms build (and run) of C++17 applications that make use of STL
    containers and other features.
    
    Backport: aded6a5
    Signed-off-by: Peter Bigot <[email protected]>
    pabigot committed Aug 21, 2019
    Configuration menu
    Copy the full SHA
    13a3f64 View commit details
    Browse the repository at this point in the history