Skip to content

Guard _DEFAULT_SOURCE with #ifndef in src/api.c#422

Open
fbarchard wants to merge 1 commit into
pytorch:mainfrom
fbarchard:fix-default-source
Open

Guard _DEFAULT_SOURCE with #ifndef in src/api.c#422
fbarchard wants to merge 1 commit into
pytorch:mainfrom
fbarchard:fix-default-source

Conversation

@fbarchard

@fbarchard fbarchard commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Fix build error:

cpuinfo/src/api.c:2:9: error: '_DEFAULT_SOURCE' macro redefined [-Werror,-Wmacro-redefined]
2 | #define _DEFAULT_SOURCE
| ^

add an #ifndef around the define

Fixes #171

Guard the definition of _DEFAULT_SOURCE in src/api.c with #ifndef to prevent macro redefinition build errors when _DEFAULT_SOURCE or _GNU_SOURCE is already defined by the build environment (e.g. -D_GNU_SOURCE=1 or -D_DEFAULT_SOURCE=1).
@meta-cla meta-cla Bot added the cla signed label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile fails with clang 16

1 participant