aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2021-05-11 23:54:01 +0000
committerJoseph Myers <joseph@codesourcery.com>2021-05-11 23:54:01 +0000
commit71d38ec80008afdbb9a059253407d80598b765c0 (patch)
tree61d4686bb430d8369941427a4d05c34522007f48 /gcc/rtl.c
parent415bcabf134b90794a134ca5dadfaf44496645d5 (diff)
downloadgcc-71d38ec80008afdbb9a059253407d80598b765c0.zip
gcc-71d38ec80008afdbb9a059253407d80598b765c0.tar.gz
gcc-71d38ec80008afdbb9a059253407d80598b765c0.tar.bz2
preprocessor: Support C2X #elifdef, #elifndef
C2X adds #elifdef and #elifndef preprocessor directives; these have also been proposed for C++. Implement these directives in libcpp accordingly. In this implementation, #elifdef and #elifndef are treated as non-directives for any language version other than c2x and gnu2x (if the feature is accepted for C++, it can trivially be enabled for relevant C++ versions). In strict conformance modes for prior language versions, this is required, as illustrated by the c11-elifdef-1.c test added. Bootstrapped with no regressions for x86_64-pc-linux-gnu. libcpp/ * include/cpplib.h (struct cpp_options): Add elifdef. * init.c (struct lang_flags): Add elifdef. (lang_defaults): Update to include elifdef initializers. (cpp_set_lang): Set elifdef for pfile based on language. * directives.c (STDC2X, ELIFDEF): New macros. (EXTENSION): Increase value to 3. (DIRECTIVE_TABLE): Add #elifdef and #elifndef. (_cpp_handle_directive): Do not treat ELIFDEF directives as directives for language versions without the #elifdef feature. (do_elif): Handle #elifdef and #elifndef. (do_elifdef, do_elifndef): New functions. gcc/testsuite/ * gcc.dg/cpp/c11-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-1.c, gcc.dg/cpp/c2x-elifdef-2.c: New tests.
Diffstat (limited to 'gcc/rtl.c')
0 files changed, 0 insertions, 0 deletions