Add -std=c17, -std=gnu17.
commita0f44249fae47c42611438838b37361574fce97d
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Oct 2017 12:17:40 +0000 (30 12:17 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Oct 2017 12:17:40 +0000 (30 12:17 +0000)
treeb75365b3cb27dcf745496a2403394a4df80386d6
parent1c59997fdcd45af3fdc5a9dd59862a281e3fd335
Add -std=c17, -std=gnu17.

C17, a bug-fix version of the C11 standard with DR resolutions
integrated, will soon go to ballot.  This patch adds corresponding
options -std=c17, -std=gnu17 (new default version, replacing
-std=gnu11 as the default), -std=iso9899:2017.  As a bug-fix version
of the standard, there is no need for flag_isoc17 or any options for
compatibility warnings; however, there is a new __STDC_VERSION__
value, so new cpplib languages CLK_GNUC17 and CLK_STDC17 are added to
support using that new value with the new options.  (If the standard
ends up being published in 2018 and being known as C18, option aliases
can be added.  Note however that -std=iso9899:199409 corresponds to a
__STDC_VERSION__ value rather than a publication date.)

(There are a couple of DR resolutions needing implementing in GCC, but
that's independent of the new options.)

(I'd propose to add -std=c2x / -std=gnu2x / -Wc11-c2x-compat for the
next major C standard revision once there are actually C2x drafts
being issued with new features included.)

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc:
* doc/invoke.texi (C Dialect Options): Document -std=c17,
-std=iso9899:2017 and -std=gnu17.
* doc/standards.texi (C Language): Document C17 support.
* doc/cpp.texi (Overview): Mention -std=c17.
(Standard Predefined Macros): Document C11 and C17 values of
__STDC_VERSION__.  Do not refer to C99 support as incomplete.
* doc/extend.texi (Inline): Do not list individual options for
standards newer than C99.
* dwarf2out.c (highest_c_language, gen_compile_unit_die): Handle
"GNU C17".
* config/rl78/rl78.c (rl78_option_override): Handle "GNU C17"
language name.

gcc/c-family:
* c.opt (std=c17, std=gnu17, std=iso9899:2017): New options.
* c-opts.c (set_std_c17): New function.
(c_common_init_options): Use gnu17 as default C version.
(c_common_handle_option): Handle -std=c17 and -std=gnu17.

gcc/testsuite:
* gcc.dg/c17-version-1.c, gcc.dg/c17-version-2.c: New tests.

libcpp:
* include/cpplib.h (enum c_lang): Add CLK_GNUC17 and CLK_STDC17.
* init.c (lang_defaults): Add GNUC17 and STDC17 data.
(cpp_init_builtins): Handle C17 value of __STDC_VERSION__.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254216 138bc75d-0d04-0410-961f-82ee72b054a4
16 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-opts.c
gcc/c-family/c.opt
gcc/config/rl78/rl78.c
gcc/doc/cpp.texi
gcc/doc/extend.texi
gcc/doc/invoke.texi
gcc/doc/standards.texi
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c17-version-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c17-version-2.c [new file with mode: 0644]
libcpp/ChangeLog
libcpp/include/cpplib.h
libcpp/init.c