Jason Merrill c5009eb887 libcpp: adjust pedwarn handling
Using cpp_pedwarning (CPP_W_PEDANTIC instead of if (CPP_PEDANTIC cpp_error
lets users suppress these diagnostics with
 #pragma GCC diagnostic ignored "-Wpedantic".

This patch changes all instances of the cpp_error (CPP_DL_PEDWARN to
cpp_pedwarning.  In cases where the extension appears in a later C++
revision, we now condition the warning on the relevant -Wc++??-extensions
flag instead of -Wpedantic; in such cases often the if (CPP_PEDANTIC) check
is retained to preserve the default non-warning behavior.

I didn't attempt to adjust the warning flags for the C compiler, since it
seems to follow a different system than C++.

The CPP_PEDANTIC check is also kept in _cpp_lex_direct to avoid an ICE in
the self-tests from cb.diagnostics not being initialized.

While working on testcases for these changes I noticed that the c-c++-common
tests are not run with -pedantic-errors by default like the gcc.dg and
g++.dg directories are.  And if I specify -pedantic-errors with dg-options,
the default -std= changes from c++?? to gnu++??, which interferes with some
other pedwarns.  So two of the tests are C++-only.

libcpp/ChangeLog:

	* include/cpplib.h (enum cpp_warning_reason): Add
	CPP_W_CXX{14,17,20,23}_EXTENSIONS.
	* charset.cc (_cpp_valid_ucn, convert_hex, convert_oct)
	(convert_escape, narrow_str_to_charconst): Use cpp_pedwarning
	instead of cpp_error for pedwarns.
	* directives.cc (directive_diagnostics, _cpp_handle_directive)
	(do_line, do_elif): Likewise.
	* expr.cc (cpp_classify_number, eval_token): Likewise.
	* lex.cc (skip_whitespace, maybe_va_opt_error)
	(_cpp_lex_direct): Likewise.
	* macro.cc (_cpp_arguments_ok): Likewise.
	(replace_args): Use -Wvariadic-macros for pedwarn about
	empty macro arguments.

gcc/c-family/ChangeLog:

	* c.opt: Add CppReason for Wc++{14,17,20,23}-extensions.
	* c-pragma.cc (handle_pragma_diagnostic_impl): Don't check
	OPT_Wc__23_extensions.

gcc/testsuite/ChangeLog:

	* c-c++-common/pragma-diag-17.c: New test.
	* g++.dg/cpp0x/va-opt1.C: New test.
	* g++.dg/cpp23/named-universal-char-escape3.C: New test.
2024-09-12 11:29:38 -04:00
2024-08-02 00:18:55 +00:00
2024-07-12 00:17:52 +00:00
2024-09-12 11:29:38 -04:00
2024-07-08 00:17:01 +00:00
2024-08-10 00:17:05 +00:00
2024-09-03 00:21:29 +00:00
2024-08-06 00:17:19 +00:00
2024-09-12 11:29:38 -04:00
2024-07-02 00:17:36 +00:00
2024-08-28 00:19:45 +00:00
2024-09-08 00:17:46 +00:00
2024-09-03 00:21:29 +00:00
2024-08-02 00:18:55 +00:00
2024-09-08 00:17:46 +00:00
2024-09-03 00:21:29 +00:00
2024-09-01 00:25:25 +00:00
2024-09-03 00:21:29 +00:00
2024-08-29 00:19:25 +00:00
2024-09-06 00:19:10 +00:00
2024-09-12 00:17:03 +00:00
2024-09-03 00:21:29 +00:00
2024-08-24 00:18:13 +00:00
2024-07-20 00:17:53 +00:00
2024-09-12 22:51:00 +08:00
2024-09-05 00:19:06 +00:00
2024-09-04 10:44:28 +02:00
2024-09-04 10:44:28 +02:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 2.7 GiB
Languages
C++ 30.7%
C 30.1%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.5%