-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
lib: newlib: Define _ANSI_SOURCE #52740
Merged
carlescufi
merged 1 commit into
zephyrproject-rtos:main
from
stephanosio:newlib_ansisource
Dec 5, 2022
Merged
lib: newlib: Define _ANSI_SOURCE #52740
carlescufi
merged 1 commit into
zephyrproject-rtos:main
from
stephanosio:newlib_ansisource
Dec 5, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit updates the Newlib integration to define `_ANSI_SOURCE` in order to prevent Newlib from defining POSIX primitives in its headers when GNU dialect is used (`-std=gnu*`). Newlib `features.h` defines `_DEFAULT_SOURCE` when `__STRICT_ANSI__` is not defined by GCC (i.e. when `-std=gnu*`), which results in the Newlib headers defining POSIX primitives that are in conflict with the POSIX primitives defined by Zephyr. Newlib must not define POSIX primitives unless the feature test macros such as `_POSIX_SOURCE`, `_GNU_SOURCE` and `_DEFAULT_SOURCE` are explicitly defined. Note that `-std=gnu` does not imply `_GNU_SOURCE` or `_DEFAULT_SOURCE` because it is only supposed to instruct the compiler to use the GNU C language dialect (i.e. GNU C language extensions). Refer to the GitHub issue zephyrproject-rtos#52739 for more details. Signed-off-by: Stephanos Ioannidis <[email protected]>
stephanosio
force-pushed
the
newlib_ansisource
branch
from
December 2, 2022 08:38
4c3d514
to
0a9622f
Compare
zephyrbot
requested review from
cfriedt,
enjiamai,
KangJianX and
keith-packard
December 2, 2022 09:24
carlescufi
approved these changes
Dec 2, 2022
stephanosio
added a commit
to stephanosio/nrfconnect-sdk-zephyr
that referenced
this pull request
Dec 2, 2022
This commit updates the Newlib integration to define `_ANSI_SOURCE` in order to prevent Newlib from defining POSIX primitives in its headers when GNU dialect is used (`-std=gnu*`). Newlib `features.h` defines `_DEFAULT_SOURCE` when `__STRICT_ANSI__` is not defined by GCC (i.e. when `-std=gnu*`), which results in the Newlib headers defining POSIX primitives that are in conflict with the POSIX primitives defined by Zephyr. Newlib must not define POSIX primitives unless the feature test macros such as `_POSIX_SOURCE`, `_GNU_SOURCE` and `_DEFAULT_SOURCE` are explicitly defined. Note that `-std=gnu` does not imply `_GNU_SOURCE` or `_DEFAULT_SOURCE` because it is only supposed to instruct the compiler to use the GNU C language dialect (i.e. GNU C language extensions). Refer to the GitHub issue #52739 for more details. Upstream PR: zephyrproject-rtos/zephyr#52740 Signed-off-by: Stephanos Ioannidis <[email protected]>
stephanosio
added a commit
to nrfconnect/sdk-zephyr
that referenced
this pull request
Dec 2, 2022
This commit updates the Newlib integration to define `_ANSI_SOURCE` in order to prevent Newlib from defining POSIX primitives in its headers when GNU dialect is used (`-std=gnu*`). Newlib `features.h` defines `_DEFAULT_SOURCE` when `__STRICT_ANSI__` is not defined by GCC (i.e. when `-std=gnu*`), which results in the Newlib headers defining POSIX primitives that are in conflict with the POSIX primitives defined by Zephyr. Newlib must not define POSIX primitives unless the feature test macros such as `_POSIX_SOURCE`, `_GNU_SOURCE` and `_DEFAULT_SOURCE` are explicitly defined. Note that `-std=gnu` does not imply `_GNU_SOURCE` or `_DEFAULT_SOURCE` because it is only supposed to instruct the compiler to use the GNU C language dialect (i.e. GNU C language extensions). Refer to the GitHub issue #52739 for more details. Upstream PR: zephyrproject-rtos/zephyr#52740 Signed-off-by: Stephanos Ioannidis <[email protected]>
cfriedt
approved these changes
Dec 3, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit updates the Newlib integration to define
_ANSI_SOURCE
in order to prevent Newlib from defining POSIX primitives in its
headers when GNU dialect is used (
-std=gnu*
).Newlib
features.h
defines_DEFAULT_SOURCE
when__STRICT_ANSI__
is not defined by GCC (i.e. when
-std=gnu*
), which results in theNewlib headers defining POSIX primitives that are in conflict with the
POSIX primitives defined by Zephyr.
Newlib must not define POSIX primitives unless the feature test macros
such as
_POSIX_SOURCE
,_GNU_SOURCE
and_DEFAULT_SOURCE
areexplicitly defined.
Note that
-std=gnu
does not imply_GNU_SOURCE
or_DEFAULT_SOURCE
because it is only supposed to instruct the compiler to use the GNU C
language dialect (i.e. GNU C language extensions).
Refer to the GitHub issue #52739 for more details.
Fixes #52739