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

define __STDC macros from C23 #721

Merged
merged 2 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/aro/Compilation.zig
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,9 @@ pub fn generateBuiltinMacros(comp: *Compilation, system_defines_mode: SystemDefi
\\#define __STDC_NO_VLA__ 1
\\#define __STDC_UTF_16__ 1
\\#define __STDC_UTF_32__ 1
\\#define __STDC_EMBED_NOT_FOUND__ 0
\\#define __STDC_EMBED_FOUND__ 1
\\#define __STDC_EMBED_EMPTY__ 2
\\
);
if (comp.langopts.standard.StdCVersionMacro()) |stdc_version| {
Expand Down
8 changes: 4 additions & 4 deletions test/cases/#embed.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ const int bar =
;
_Static_assert(bar == 'H', "");

# if __has_embed("include/embed data" foo(1)) != 0
# if __has_embed("include/embed data" foo(1)) != __STDC_EMBED_NOT_FOUND__
#error unknown param was accepted
#endif

# if __has_embed("doesn't exist") != 0
# if __has_embed("doesn't exist") != __STDC_EMBED_NOT_FOUND__
#error non-existent embed found
#endif

# if __has_embed("include/embed data" limit(1)) != 1
# if __has_embed("include/embed data" limit(1)) != __STDC_EMBED_FOUND__
#error embed should be found
#endif

# if __has_embed("include/empty") != 2
# if __has_embed("include/empty") != __STDC_EMBED_EMPTY__
#error empty wasn't detected
#endif

Expand Down
Loading