Commit Graph

80 Commits

Author SHA1 Message Date
Edward Smith-Rowland 3976796b6d re PR preprocessor/61389 (libcpp diagnostics shouldn't talk about ISO C99 for C++ input files)
2014-07-10  Edward Smith-Rowland  <3dw4rd@verizon.net>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR CPP/61389
	* macro.c (_cpp_arguments_ok, parse_params, create_iso_definition):
	Warning messages mention C++11 in c++ mode and C99 in c mode.
	* lex.c (lex_identifier_intern, lex_identifier): Ditto


Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r212441
2014-07-10 22:26:50 +00:00
Edward Smith-Rowland 7aee864645 PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped
libcpp/

2014-07-09  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped
	by preprocessor
	* lex.c (lex_raw_string ()): Do not warn about invalid suffix
	if skipping. (lex_string ()): Ditto.


gcc/testsuite/

2014-07-09  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/58155 - -Wliteral-suffix warns about tokens which are skipped
	g++.dg/cpp0x/pr58155.C: New.

From-SVN: r212392
2014-07-09 13:33:58 +00:00
Rainer Orth d9f069ab4f Remove obsolete Solaris 9 support
libstdc++-v3:
	* configure.host: Remove solaris2.9 handling.
	Change os_include_dir to os/solaris/solaris2.10.
	* acinclude.m4 (ac_has_gthreads): Remove solaris2.9* handling.
	* crossconfig.m4: Remove *-solaris2.9 handling, simplify.
	* configure: Regenerate.
	* config/abi/post/solaris2.9: Remove.
	* config/os/solaris/solaris2.9: Rename to ...
	* config/os/solaris/solaris2.10: ... this.
	* config/os/solaris/solaris2.10/os_defines.h (CLOCK_MONOTONIC):
	Remove.

	* doc/xml/manual/configure.xml (--enable-libstdcxx-threads):
	Remove Solaris 9 reference.
	* doc/html/manual/configure.html: Regenerate.

	* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
	Remove *-*-solaris2.9 xfail.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc:
	Likewise.

	* testsuite/ext/enc_filebuf/char/13598.cc: Remove *-*-solaris2.9
	xfail.

	libjava:
	* configure.ac (THREADLIBS, THREADSPEC): Remove *-*-solaris2.9
	handling.
	* configure: Regenerate.

	libgfortran:
	* config/fpu-387.h [__sun__ && __svr4__]: Remove SSE execution
	check.

	libgcc:
	* config/i386/crtfastmath.c (set_fast_math): Remove SSE execution
	check.
	* config/i386/sol2-unwind.h (x86_fallback_frame_state): Remove
	Solaris 9 single-threaded support.
	* config/sparc/sol2-unwind.h (sparc64_is_sighandler): Remove
	Solaris 9 single-threaded support.  Add call_user_handler code
	sequences.
	(sparc_is_sighandler): Likewise.

	libcpp:
	* lex.c: Remove Solaris 9 reference.

	gcc/testsuite:
	* gcc.c-torture/compile/pr28865.c: Remove dg-xfail-if.

	* gcc.dg/c99-stdint-6.c: Remove dg-options for *-*-solaris2.9.
	* gcc.dg/lto/20090210_0.c: Remove dg-extra-ld-options for
	*-*-solaris2.9.
	* gcc.dg/torture/pr47917.c: Remove dg-options for *-*-solaris2.9.
	* gcc.target/i386/pr22076.c: Remove i?86-*-solaris2.9 handling
	from dg-options.
	* gcc.target/i386/pr22152.c: Remove i?86-*-solaris2.9 handling
	from dg-additional-options.
	* gcc.target/i386/vect8-ret.c: Remove i?86-*-solaris2.9 handling
	from dg-options.

	* gcc.dg/vect/tree-vect.h (check_vect): Remove Solaris 9 SSE2
	execution check.
	* gcc.target/i386/sse-os-support.h [__sun__ && __svr4__]
	(sigill_hdlr): Remove.
	(sse_os_support) [__sun__ && __svr4__]: Remove SSE execution
	check.

	* gfortran.dg/erf_3.F90: Remove sparc*-*-solaris2.9* handling.
	* gfortran.dg/fmt_en.f90: Remove i?86-*-solaris2.9* handling.
	* gfortran.dg/round_4.f90: Remove *-*-solaris2.9* handling.

	* lib/target-supports.exp (add_options_for_tls): Remove
	*-*-solaris2.9* handling.

	gcc:
	* config.gcc (enable_obsolete): Remove *-*-solaris2.9*.
	(*-*-solaris2.[0-9] | *-*-solaris2.[0-9].*): Mark unsupported.
	(*-*-solaris2*): Simplify.
	(i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*): Likewise.
	(i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*): Remove
	*-*-solaris2.9* handling.

	* configure.ac (gcc_cv_as_hidden): Remove test for Solaris 9/x86
	as bug.
	(gcc_cv_ld_hidden): Remove *-*-solaris2.9* handling.
	(ld_tls_support): Remove i?86-*-solaris2.9, sparc*-*-solaris2.9
	handling, simplify.
	(gcc_cv_as_gstabs_flag): Remove workaround for Solaris 9/x86 as bug.
	* configure: Regenerate.

	* config/i386/sol2-9.h: Remove.

	* doc/install.texi (Specific, i?86-*-solaris2.9): Remove.
	(Specific, *-*-solaris2*): Mention Solaris 9 support removal.
	Remove Solaris 9 references.

	fixincludes:
	* inclhack.def (math_exception): Bypass on *-*-solaris2.1[0-9]*.
	(solaris_int_types): Remove.
	(solaris_longjmp_noreturn): Remove.
	(solaris_mutex_init_2): Remove.
	(solaris_once_init_2): Remove.
	(solaris_sys_va_list): Remove.
	* fixincl.x: Regenerate.
	* tests/base/iso/setjmp_iso.h: Remove.
	* tests/base/pthread.h [SOLARIS_MUTEX_INIT_2_CHECK]: Remove.
	[SOLARIS_ONCE_INIT_1_CHECK]: Remove wrapping done by
	solaris_once_init_2.
	[SOLARIS_ONCE_INIT_2_CHECK]: Remove.
	* tests/base/sys/int_types.h: Remove.
	* tests/base/sys/va_list.h: Remove.

	contrib:
	* config-list.mk (LIST): Remove sparc-sun-solaris2.9, i686-solaris2.9.

From-SVN: r209621
2014-04-22 12:30:59 +00:00
Richard Sandiford 35c3d610e3 Update copyright years in libcpp/
From-SVN: r206293
2014-01-02 22:24:45 +00:00
Bill Schmidt aadce58599 lex.c (search_line_fast): Correct for little endian.
2013-11-18  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	* lex.c (search_line_fast): Correct for little endian.

From-SVN: r204970
2013-11-18 16:21:42 +00:00
Joseph Myers d3f4ff8b51 ucnid-2011-1.c: New test.
gcc/testsuite:
	* c-c++-common/cpp/ucnid-2011-1.c: New test.

libcpp:
	* ucnid.tab: Add C11 and C11NOSTART data.
	* makeucnid.c (digit): Rename enum value to N99.
	(C11, N11, all_languages): New enum values.
	(NUM_CODE_POINTS, MAX_CODE_POINT): New macros.
	(flags, decomp, combining_value): Use NUM_CODE_POINTS as array
	size.
	(decomp): Use unsigned int as element type.
	(all_decomp): New array.
	(read_ucnid): Handle C11 and C11NOSTART.  Use MAX_CODE_POINT.
	(read_table): Use MAX_CODE_POINT.  Store all decompositions in
	all_decomp.
	(read_derived): Use MAX_CODE_POINT.
	(write_table): Use NUM_CODE_POINTS.  Print N99, C11 and N11
	flags.  Print whole array variable declaration rather than just
	array contents.
	(char_id_valid, write_context_switch): New functions.
	(main): Call write_context_switch.
	* ucnid.h: Regenerate.
	* include/cpplib.h (struct cpp_options): Add c11_identifiers.
	* init.c (struct lang_flags): Add c11_identifiers.
	(cpp_set_lang): Set c11_identifiers option from selected language.
	* internal.h (struct normalize_state): Document "previous" as
	previous starter character.
	(NORMALIZE_STATE_UPDATE_IDNUM): Take character as argument.
	* charset.c (DIG): Rename enum value to N99.
	(C11, N11): New enum values.
	(struct ucnrange): Give name to struct.  Use short for flags and
	unsigned int for end of range.  Include ucnid.h for whole variable
	declaration.
	(ucn_valid_in_identifier): Allow for characters up to 0x10FFFF.
	Allow for C11 in determining valid characters and valid start
	characters.  Use check_nfc for non-Hangul context-dependent
	checks.  Only store starter characters in nst->previous.
	(_cpp_valid_ucn): Pass new argument to
	NORMALIZE_STATE_UPDATE_IDNUM.
	* lex.c (lex_identifier): Pass new argument to
	NORMALIZE_STATE_UPDATE_IDNUM.  Call NORMALIZE_STATE_UPDATE_IDNUM
	after initial non-UCN part of identifier.
	(lex_number): Pass new argument to NORMALIZE_STATE_UPDATE_IDNUM.

From-SVN: r204886
2013-11-16 00:05:08 +00:00
Edward Smith-Rowland 7057e6452b Implement C++14 digit separators.
libcpp:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* include/cpplib.h (cpp_options): Add digit_separators flag.
	* internal.h (DIGIT_SEP(c)): New macro.
	* expr.c (cpp_classify_number): Check improper placement of digit sep;
	(cpp_interpret_integer): Skip over digit separators.
	* init.c (lang_flags): Add digit_separators flag; (lang_defaults): Add
	digit separator flags per language; (cpp_set_lang): Set
	digit_separators
	* lex.c (lex_number): Add digits separator to allowable characters for
	C++14.


gcc/c-family:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* c-lex.c (interpret_float): Remove digit separators from scratch string
	before building real literal.


gcc/testsuite:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* g++.dg/cpp1y/digit-sep.C: New.
	* g++.dg/cpp1y/digit-sep-neg.C: New.
	* g++.dg/cpp1y/digit-sep-cxx11-neg.C: New.


libstdc++-v3:

2013-10-31  Edward Smith-Rowland  <3dw4rd@verizon.net>

        Implement C++14 digit separators.
	* include/include/bits/parse_numbers.h: Change struct _Digit<_Base, '`'>
	to struct _Digit<_Base, '\''>.

From-SVN: r204260
2013-10-31 14:01:23 +00:00
Jakub Jelinek 8cf887352b re PR preprocessor/57620 (Phantom terminator confuses raw string literal parsing.)
PR preprocessor/57620
	* lex.c (lex_raw_string): Undo phase1 and phase2 transformations
	between R" and final " rather than only in between R"del( and )del".

	* c-c++-common/raw-string-2.c (s12, u12, U12, L12): Remove.
	(main): Don't test {s,u,U,L}12.
	* c-c++-common/raw-string-13.c: New test.
	* c-c++-common/raw-string-14.c: New test.
	* c-c++-common/raw-string-15.c: New test.
	* c-c++-common/raw-string-16.c: New test.

From-SVN: r201091
2013-07-21 04:28:03 +02:00
Jakub Jelinek d5e48350b4 re PR preprocessor/57824 (Raw string literals not handled correctly in macro arguments or deferred pragmas)
PR preprocessor/57824
	* lex.c (lex_raw_string): Allow reading new-lines if
	in_deferred_pragma or if parsing_args and there is still
	data in the current buffer.

	* c-c++-common/raw-string-17.c: New test.
	* c-c++-common/gomp/pr57824.c: New test.

From-SVN: r200879
2013-07-10 18:52:19 +02:00
Jakub Jelinek c26302d535 c-ppoutput.c (scan_translation_unit): Call account_for_newlines for all CPP_TOKEN_FLD_STR tokens, not just CPP_COMMENT.
* c-ppoutput.c (scan_translation_unit): Call account_for_newlines
	for all CPP_TOKEN_FLD_STR tokens, not just CPP_COMMENT.

	* include/cpplib.h (cpp_token_val_index): Change parameter type to
	const cpp_token *.
	* lex.c (cpp_token_val_index): Likewise.

	* c-c++-common/raw-string-18.c: New test.
	* c-c++-common/raw-string-19.c: New test.

From-SVN: r200878
2013-07-10 18:49:24 +02:00
Jakub Jelinek 87e356bada re PR preprocessor/57757 (CPP extra inserted whitespace needs to be reviewed for C++11 user-defined literals)
PR preprocessor/57757
	* lex.c (cpp_avoid_paste): Avoid pasting CPP_{,W,UTF8}STRING
	or CPP_STRING{16,32} with CPP_NAME or SPELL_LITERAL token that
	starts if a-zA-Z_.

	* g++.dg/cpp/paste1.C: New test.
	* g++.dg/cpp/paste2.C: New test.

From-SVN: r200875
2013-07-10 18:40:49 +02:00
Ed Smith-Rowland c865f9238a lex.c (lex_raw_string(), [...]): Constrain suffixes treated as concatenated literal and macro to just the...
libcpp:

2013-06-28  Ed Smith-Rowland  <3dw4rd@verizon.net>

	* lex.c (lex_raw_string(), lex_string()): Constrain suffixes treated
	as concatenated literal and macro to just the patterns found in
	inttypes.h; (is_macro()): New.


gcc/cp:

2013-06-28  Ed Smith-Rowland  <3dw4rd@verizon.net>

	* cp-tree.h (UDLIT_OP_ANSI_PREFIX): Remove space.
	* parser.c (cp_parser_operator()): Parse user-defined string
	literal as literal operator.


gcc/testsuite:

2013-06-28  Ed Smith-Rowland  <3dw4rd@verizon.net>

	* g++.dg/cpp0x/udlit-nospace-neg.C: Adjust.
	* g++.dg/cpp1y/udlit-enc-prefix-neg.C: New.
	* g++.dg/cpp1y/udlit-userdef-string.C: New.
	* g++.dg/cpp1y/complex_literals.h: New.

From-SVN: r200563
2013-06-29 03:41:58 +00:00
Paolo Carlini 61949153f4 cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
/libcpp
2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/cpplib.h (enum c_lang): Add CLK_GNUCXX1Y and CLK_CXX1Y.
	* init.c (lang_defaults): Add defaults for the latter.
	(cpp_init_builtins): Define __cplusplus as 201300L for the latter.
	* lex.c (_cpp_lex_direct): Update.

/gcc/c-family
2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* c-opts.c (set_std_cxx11): Use CLK_CXX1Y and CLK_GNUCXX1Y.

/gcc/testsuite
2013-04-24  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp1y/cplusplus.C: New.

From-SVN: r198261
2013-04-24 19:33:54 +00:00
Jakub Jelinek 1a80db971d configure.ac: Don't define ENABLE_CHECKING whenever --enable-checking is seen...
* configure.ac: Don't define ENABLE_CHECKING whenever
	--enable-checking is seen, instead use similar --enable-checking=yes
	vs. --enable-checking=release default as gcc/ subdir has and
	define ENABLE_CHECKING if ENABLE_CHECKING is defined in gcc/.
	Define ENABLE_VALGRIND_CHECKING if requested.
	* lex.c (new_buff): If ENABLE_VALGRIND_CHECKING, put _cpp_buff
	struct first in the allocated buffer and result->base after it.
	(_cpp_free_buff): If ENABLE_VALGRIND_CHECKING, free buff itself
	instead of buff->base.
	* config.in: Regenerated.
	* configure: Regenerated.

From-SVN: r196333
2013-02-28 10:58:47 +01:00
Ed Smith-Rowland 561f7fc72c re PR c++/55582 ([C++11] Unable to define string user-defined literal without leading underscore.)
gcc/libcpp/

2013-02-13  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/55582
	* libcpp/lex.c (lex_raw_string): Allow string literal with suffix
	beginning with 's' to be parsed as a C++11 user-defined literal.


gcc/testsuite/

2013-02-13  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/55582
	* g++.dg/cpp0x/udlit-string-literal.h: New.
	* g++.dg/cpp0x/udlit-string-literal.C: New.

From-SVN: r196041
2013-02-14 02:55:42 +00:00
Richard Sandiford 500f3ed906 Update copyright years in libcpp.
From-SVN: r195162
2013-01-14 18:13:59 +00:00
Paolo Carlini 1582c67762 PR c++/54526 (again)
/libcpp
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54526 (again)
	* lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.

/gcc/cp
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54526 (again)
	* parser.c (cp_parser_template_id): Revert core of previous change
	(keep adjusted inform message).

/gcc/testsuite
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/54526 (again)
	* g++.dg/cpp0x/parse2.C: Extend.
	* g++.old-deja/g++.other/crash28.C: Adjust.

From-SVN: r194909
2013-01-04 15:30:24 +00:00
Tobias Burnus 55e7f90769 files.c (read_file_guts, [...]): Free memory before returning.
2012-10-15  Tobias Burnus  <burnus@net-b.de>

        * files.c (read_file_guts, _cpp_save_file_entries): Free memory
        before returning.
        * lex.c (warn_about_normalization): Ditto.
        * mkdeps.c (deps_save): Ditto.
        * pch.c (cpp_valid_state): Ditto.

From-SVN: r192474
2012-10-15 22:08:57 +02:00
Uros Bizjak d35d1c0fee lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and __builtin_ia32_pcmpestri128 instead of asm.
* lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and
	__builtin_ia32_pcmpestri128 instead of asm.

From-SVN: r188782
2012-06-19 18:28:50 +02:00
Dodji Seketeli 53a103d304 PR bootstrap/53459 - unused local typedef when building on altivec
PR bootstrap/53459
	* lex.c (search_line_fast): Avoid unused local typedefs to simulate
	a static assertion.

From-SVN: r187947
2012-05-29 11:42:39 +02:00
Dodji Seketeli 6de6b1ec5f Revert "PR bootstrap/53459 - unused local typedef when building on altivec"
This reverts commit r187853

From-SVN: r187946
2012-05-29 11:42:28 +02:00
Dodji Seketeli 27c53c0cce PR bootstrap/53459 - unused local typedef when building on altivec
libcpp/

	PR bootstrap/53459
	* lex.c (search_line_fast): Remove unused typedef check_count.

From-SVN: r187853
2012-05-24 23:05:49 +02:00
Dodji Seketeli 112448b448 Don't use C++ style comments in libcpp
I noticed that the file lex.c had C++ style comments, which I believe
is against the coding standards of the project.

Fixed, tested and applied to master as per the obvious rule.

libcpp/

	* lex.c (lex_raw_string): Change C++ style comments into C
	style comments.
	(lex_string): Likewise.

From-SVN: r186946
2012-04-29 18:27:08 +02:00
Ollie Wild 7f5f5f98c5 Add new option, -Wliteral-suffix.
This option, which is enabled by default, causes the preprocessor to warn
when a string or character literal is followed by a ud-suffix which does
not begin with an underscore.  According to [lex.ext]p10, this is
ill-formed.

Also modifies the preprocessor to treat such ill-formed suffixes as separate
preprocessing tokens.  This is consistent with the Clang front end (see
http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
backwards compatibility with code that uses formatting macros from
<inttypes.h>, as in the following code block:

  int main() {
    int64_t i64 = 123;
    printf("My int64: %"PRId64"\n", i64);
  }

Google ref b/6377711.

2012-04-27   Ollie Wild  <aaw@google.com>

	PR c++/52538
	* gcc/c-family/c-common.c: Add CPP_W_LITERAL_SUFFIX mapping.
	* gcc/c-family/c-opts.c (c_common_handle_option): Handle
	OPT_Wliteral_suffix.
	* gcc/c-family/c.opt: Add Wliteral-suffix.
	* gcc/doc/invoke.texi (Wliteral-suffix): Document new option.
	* gcc/testsuite/g++.dg/cpp0x/Wliteral-suffix.c: New test.
	* libcpp/include/cpplib.h (struct cpp_options): Add new field,
	warn_literal_suffix.
	(CPP_W_LITERAL_SUFFIX): New enum.
	* libcpp/init.c (cpp_create_reader): Default initialization of
	warn_literal_suffix.
	* libcpp/lex.c (lex_raw_string): Treat user-defined literals which
	don't begin with '_' as separate tokens and produce a warning.
	(lex_string): Ditto.

From-SVN: r186909
2012-04-27 14:29:32 +00:00
Richard Earnshaw e75b54a2d9 * lex.c (search_line_fast): Provide Neon-optimized version for ARM.
From-SVN: r185702
2012-03-22 17:54:55 +00:00
Rainer Orth 7888f2660e Remove obsolete Solaris 8 support
libstdc++-v3:
	* config/os/solaris/solaris2.8: Rename to ...
	* config/os/solaris/solaris2.9: ... this.
	* config/abi/post/solaris2.8: Rename to ...
	* config/abi/post/solaris2.9: ... this.
	* configure.host (os_include_dir): Remove solaris2.8.
	Reflect renaming.
	(abi_baseline_pair): Remove *-*-solaris2.8.
	Reflect renaming.

	* configure.ac (GLIBCXX_CHECK_MATH_PROTO): Remove
	(GLIBCXX_CHECK_STDLIB_PROTO): Remove.
	* acinclude.m4 (GLIBCXX_CHECK_MATH_PROTO): Remove
	(GLIBCXX_CHECK_STDLIB_PROTO): Remove.
	(GLIBCXX_CHECK_GTHREADS): Remove Solaris 8 handling.
	* crossconfig.m4 (GLIBCXX_CROSSCONFIG): Remove *-solaris2.8
	handling.
	* configure: Regenerate.
	* config.h.in: Regenerate.

	* config/os/solaris/solaris2.9/os_defines.h
	(__CORRECT_ISO_CPP_MATH_H_PROTO): Define.
	(__CORRECT_ISO_CPP_STDLIB_H_PROTO): Define.
	* include/c_global/cmath: Rename __CORRECT_ISO_CPP_MATH_H_PROTO1
	to __CORRECT_ISO_CPP_MATH_H_PROTO.
	[!__CORRECT_ISO_CPP_MATH_H_PROTO2]: Remove.
	* include/tr1/cmath: Rename __CORRECT_ISO_CPP_MATH_H_PROTO1 to
	__CORRECT_ISO_CPP_MATH_H_PROTO.

	* doc/xml/manual/configure.xml (Configure, --enable-libstdcxx-threads):
	Remove Solaris 8 reference.

	* testsuite/27_io/basic_istream/extractors_arithmetic/char/12.cc:
	Don't xfail on *-*-solaris2.8.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/12.cc:
	Likewise.
	* testsuite/ext/enc_filebuf/char/13598.cc: Don't xfail on
	*-*-solaris2.8.

	libjava:
	* configure.ac (THREADLIBS): Remove *-*-solaris2.8 handling.
	* configure: Regenerate.

	libgcc:
	* config/i386/sol2-unwind.h (x86_fallback_frame_state): Remove
	Solaris 8 handling.
	* config/sparc/sol2-unwind.h (sparc64_is_sighandler): Remove
	Solaris 8 handling.
	(sparc_is_sighandler): Likewise.

	libcpp:
	* lex.c: Remove Solaris 8 reference.

	gcc/testsuite:
	* g++.dg/warn/miss-format-1.C: Remove *-*-solaris2.8 handling.
	* gcc.dg/c99-stdint-6.c: Likewise.
	* gcc.dg/lto/20090210_0.c: Likewise.
	* gcc.dg/pr28796-2.c: Don't skip on sparc*-sun-solaris2.8.
	* gcc.dg/pragma-init-fini.c: Don't skip on i?86-*-solaris2.8.
	* gcc.dg/pragma-init-fini-2.c: Likewise.
	* gcc.dg/torture/pr47917.c: Remove *-*-solaris2.8 handling.
	* gcc.target/i386/pr22076.c: Remove i?86-*-solaris2.8 handling.
	* gcc.target/i386/pr22152.c: Likewise.
	* gcc.target/i386/vect8-ret.c: Likewise.
	* lib/target-supports.exp (add_options_for_tls): Remove Solaris 8
	handling.

	gcc:
	* config.gcc (enable_obsolete): Remove *-*-solaris2.8*.
	(*-*-solaris2.[0-8], *-*-solaris2.[0-8].*): Mark unsupported.
	(i[34567]86-*-solaris2*, x86_64-*-solaris2.1[0-9]*): Remove
	Solaris 8 support.
	* configure.ac (gcc_cv_ld_hidden): Remove *-*-solaris2.8*.
	(ld_tls_support): Remove Solaris 8 references.
	(lwp_dir, lwp_spec): Remove support for alternate thread library.
	* acinclude.m4 (gcc_cv_initfini_array): Remove *-*-solaris2.*
	tests.
	* configure: Regenerate.
	* config.in: Regenerate.

	* config/sol2.h (LINK_SPEC): Remove LIB_THREAD_LDFLAGS_SPEC.
	* config/i386/sol2.h: Remove Solaris 8 references.

	* doc/install.texi (Specific, i?86-*-solaris2.[89]): Rename to ...
	(i?86-*-solaris2.9): ... this.
	Remove Solaris 8 references.
	(Specific, *-*-solaris2*): Document Solaris 8 removal.
	Remove Solaris 8 references.

	fixincludes:
	* inclhack.def (math_exception): Remove duplicate.
	(solaris_cond_init): Remove.
	(solaris_sys_va_list): Remove Solaris 8 support.
	* fixincl.x: Regenerate.
	* tests/base/pthread.h [SOLARIS_COND_INIT_CHECK]: Remove.

From-SVN: r185392
2012-03-14 17:08:03 +00:00
Jakub Jelinek b0c084b712 re PR bootstrap/50237 (bootstrap comparison failure for libcpp/lex.o)
PR bootstrap/50237
	* internal.h (_cpp_init_lexer): New prototype.
	* init.c (init_library): Call it.
	* lex.c (init_vectorized_lexer): Remove constructor attribute,
	add inline keyword.
	(HAVE_init_vectorized_lexer): Define.
	(_cpp_init_lexer): New function.

From-SVN: r182090
2011-12-07 23:05:59 +01:00
Ed Smith-Rowland 3ce4f9e4d2 Implement C++11 user-defined literals.
libcpp/
	* expr.c: (cpp_interpret_float_suffix, cpp_interpret_int_suffix,
	cpp_userdef_string_remove_type, cpp_userdef_string_add_type,
	cpp_userdef_char_remove_type, cpp_userdef_char_add_type,
	cpp_userdef_string_p, cpp_userdef_char_p, cpp_get_userdef_suffix): New.
	(cpp_classify_number): Classify unrecognized tokens as user-defined
	literals.
	* include/cpplib.h: Add new tokens for user-defined literals.
	* init.c: Add new preprocessor flag (cxx11).
	* lex.c: (lex_string, lex_raw_string): Handle user-defined literals
	including concatenation and promotion with suffixes.
c-family/
	* c-common.c (build_userdef_literal): New.
	* c-common.def: New tree code.
	* c-common.h (tree_userdef_literal): New tree struct and accessors.
	* c-lex.c (interpret_float): Add suffix parm.
	(c_lex_with_flags): Build literal tokens.
cp/
	* cp-objcp-common.c: (cp_tree_size) Return size of USERDEF_LITERAL tree.
	* cp-tree.h: (UDLIT_OP_*, UDLIT_OPER_P): Literal operator
	name tools. New tree code for user-defined literals.
	* cxx-pretty-print.h: (pp_cxx_userdef_literal) New.
	* cxx-pretty-print.c: (pp_cxx_userdef_literal) New.
	(pp_cxx_primary_expression, pp_cxx_expression): Use it.
	* decl.c: (cp_tree_node_structure): Return new tree code.
	(duplicate_decls): Check for raw vs. template operator conflicts.
	(grokfndecl, grokdeclarator): New checks for literal operators.
	* error.c: (dump_expr): Warn about user-defined literals
	in C++98 mode. (dump_function_name): Pretty printing.
	* mangle.c: (write_literal_operator_name): New.
	(write_unqualified_id, write_unqualified_name): Use it.
	* parser.c: (cp_parser_operator): Handle operator"".
	(cp_parser_userdef_char_literal, cp_parser_userdef_numeric_literal,
	cp_parser_userdef_string_literal): New.
	(cp_parser_primary_expression): Handle new user-defined literal tokens
	with new functions.
	* semantics.c: (potential_constant_expression_1): Add
	user-defined literals.
	* typeck.c (check_raw_literal_operator,
	check_literal_operator_args): New.

From-SVN: r180536
2011-10-26 15:30:59 -04:00
Dodji Seketeli ad2305adb4 Fix cpp_peek_token behaviour (PR bootstrap/50778)
libcpp/

	* include/internal.h (_cpp_remaining_tokens_num_in_context): Take the
	context to act upon.
	* lex.c (_cpp_remaining_tokens_num_in_context): Likewise.  Update
	comment.
	(cpp_token_from_context_at): Likewise.
	(cpp_peek_token): Use the context to peek tokens from.

From-SVN: r180328
2011-10-22 19:49:18 +02:00
Dodji Seketeli cbbcf65511 Fix thinko in _cpp_remaining_tokens_num_in_context
libcpp/

	* lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of
	number of tokens.

From-SVN: r180239
2011-10-20 10:49:29 +02:00
Tom Tromey 92582b753e Generate virtual locations for tokens
This second instalment uses the infrastructure of the previous patch
to allocate a macro map for each macro expansion and assign a virtual
location to each token resulting from the expansion.

To date when cpp_get_token comes across a token that happens to be a
macro, the macro expander kicks in, expands the macro, pushes the
resulting tokens onto a "token context" and returns a dummy padding
token. The next call to cpp_get_token goes look into the token context
for the next token [which is going to result from the previous macro
expansion] and returns it.  If the token is a macro, the macro expander
kicks in and you know the story.

This patch piggy-backs on that macro expansion process, so to speak.
First it modifies the macro expander to make it create a macro map for
each macro expansion. It then allocates a virtual location for each
resulting token.  Virtual locations of tokens resulting from macro
expansions are then stored on a special kind of context called an
"expanded tokens context".  In other words, in an expanded tokens
context, there are tokens resulting from macro expansion and their
associated virtual locations.  cpp_get_token_with_location is modified
to return the virtual location of tokens resulting from macro
expansion.  Note that once all tokens from an expanded token context have
been consumed and the context and is freed, the memory used to store the
virtual locations of the tokens held in that context is freed as well.
This helps reducing the overall peak memory consumption.

The client code that was getting macro expansion point location from
cpp_get_token_with_location now gets virtual location from it. Those
virtual locations can in turn be resolved into the different
interesting physical locations thanks to the linemap API exposed by
the previous patch.

Expensive progress. Possibly. So this whole virtual location
allocation business is switched off by default. So by default no
extended token is created. No extended token context is created
either. One has to use -ftrack-macro-expansion to switch this on. This
complicates the code but I believe it can be useful as some of our
friends found out at http://llvm.org/bugs/show_bug.cgi?id=5610

The patch tries to reduce the memory consumption by freeing some token
context memory that was being reused before. I didn't notice any
compilation slow down due to this immediate freeing on my GNU/Linux
system.

As no client code tries to resolve virtual locations to anything but
what was being done before, no new test case has been added.

Co-Authored-By: Dodji Seketeli <dodji@redhat.com>

From-SVN: r180082
2011-10-17 11:59:12 +02:00
Gabriel Charette e3dfef44ef Add ability to force lexed tokens' source_locations.
Use it to force BUILTINS_LOCATION when declaring builtins instead of creating a <built-in> entry in the line_table which is wrong.

	* c-opts.c (c_finish_options): Force BUILTINS_LOCATION for tokens
	defined in cpp_init_builtins and c_cpp_builtins.

	gcc/fortran/ChangeLog
	* cpp.c (gfc_cpp_init): Force BUILTINS_LOCATION for tokens
	defined in cpp_define_builtins.

	libcpp/ChangeLog
	* init.c (cpp_create_reader): Inititalize forced_token_location_p.
	* internal.h (struct cpp_reader): Add field forced_token_location_p.
	* lex.c (_cpp_lex_direct): Use forced_token_location_p.
	(cpp_force_token_locations): New.
	(cpp_stop_forcing_token_locations): New.

From-SVN: r177973
2011-08-22 20:41:07 +00:00
Joseph Myers a48e3dd10e c1x-uni-string-1.c, [...]: New tests.
gcc/testsuite:
	* gcc.dg/c1x-uni-string-1.c, gcc.dg/c1x-uni-string-2.c: New tests.

libcpp:
	* include/cpplib.h (struct cpp_options): Add rliterals.
	* init.c  (struct lang_flags, lang_defaults): Add rliterals.
	(cpp_set_lang): Set rliterals option.
	(cpp_init_builtins): Define __STDC_UTF_16__ and __STDC_UTF_32__.
	* lex.c (_cpp_lex_direct): Only accept raw strings if rliterals.

From-SVN: r177868
2011-08-18 16:13:49 +01:00
Gabriel Charette 3f6ced102d LINEMAP_POSITION_FOR_COLUMN had the exact same effect as linemap_position_for_column...
LINEMAP_POSITION_FOR_COLUMN had the exact same effect as
linemap_position_for_column, removed it and updated users
to use linemap_position_for_column instead

        libcpp/ChangeLog
	* include/line-map.h (LINEMAP_POSITION_FOR_COLUMN): Remove.
	Update all users to use linemap_position_for_column instead.

        gcc/go/ChangeLog
	* gofrontend/lex.cc (Lex::location): Update to use
	linemap_position_for_column instead.
        (Lex::earlier_location): Likewise.

From-SVN: r177768
2011-08-15 20:35:58 +00:00
Jason Merrill 8787a05aaa re PR c++/45399 ([C++0x] Warning for \0 in raw strings)
PR c++/45399
	* lex.c (lex_raw_string): Don't check for embedded NUL.

From-SVN: r175121
2011-06-16 18:09:12 -04:00
Uros Bizjak 5e70c0b572 * lex.c (init_vectorized_lexer): Fix comparison of masked value.
From-SVN: r174037
2011-05-22 21:04:54 +02:00
Uros Bizjak ef230b3836 re PR bootstrap/49104 (bootstrap failure on AMD K6-2 with illegal instruction (cmove) in stage2)
PR target/49104
	* config/i386/cpuid.h (bit_MMXEXT): New define.

libcpp/ChangeLog:

2011-05-22  Uros Bizjak  <ubizjak@gmail.com>

	PR target/49104
	* lex.c (init_vectorized_lexer): Do not set "minimum" when __3dNOW_A__
	is defined.  Check bit_MMXEXT and bit_CMOV to use search_line_mmx.

From-SVN: r174032
2011-05-22 20:53:32 +02:00
Jakub Jelinek 6cfae07011 re PR preprocessor/48740 (Raw C++0x strings and trigraphs mix badly)
PR preprocessor/48740
	* lex.c (lex_raw_string): When raw string ends with
	??) followed by raw prefix and ", ensure it is preprocessed
	with ??) rather than ??].

	* c-c++-common/raw-string-11.c: New test.

From-SVN: r172903
2011-04-24 01:32:09 +02:00
Richard Henderson 01956319b6 re PR bootstrap/45381 (Bootstrap failure for powerpc-apple-darwin9: error: AltiVec argument passed to unprototyped function)
PR bootstrap/45381
* lex.c [ALTIVEC] (search_line_fast): Require gcc version 4.5.

From-SVN: r171165
2011-03-18 13:20:35 -07:00
Kai Tietz 651a20b54b re PR preprocessor/17349 (// comments cause weird behaviour with options -E -C)
2010-11-16  Kai Tietz  <kai.tietz@onevision.com>

        PR preprocessor/17349
        * lex.c (save_comment): Handle in argument passing c++
        comments special.

2010-11-16  Kai Tietz  <kai.tietz@onevision.com>

        PR preprocessor/17349
        * gcc.dg/cpp/cmdlne-C3.c: New.

From-SVN: r166817
2010-11-16 20:50:17 +01:00
Richard Henderson 6f173e52cb re PR bootstrap/45376 (no such instruction: `pcmpestri $0,(%rdi),%xmm0')
PR bootstrap/45376
        * configure.ac (HAVE_SSE4): New check.
        * configure, config.in: Rebuild.
        * lex.c (search_line_sse42): Omit if !HAVE_SSE4.

From-SVN: r163528
2010-08-24 14:08:05 -07:00
Rainer Orth 789d73cb17 lex.c: Disable init_vectorized_lexer etc.
* lex.c [__sun__ && __svr4__]: Disable init_vectorized_lexer
	etc. on Solaris 2/x86.

From-SVN: r163522
2010-08-24 17:23:35 +00:00
Richard Henderson 246a2fcb5e Vectorize fast path of _cpp_clean_line.
* configure.ac (AC_C_BIGENDIAN, AC_TYPE_UINTPTR_T): New tests.
	(ssize_t): Check via AC_TYPE_SSIZE_T instead of AC_CHECK_TYPE.
	(ptrdiff_t): Check via AC_CHECK_TYPE.
	* config.in, configure: Rebuild.
	* system.h: Include stdint.h, if available.
	* lex.c (WORDS_BIGENDIAN): Provide default.
	(acc_char_mask_misalign, acc_char_replicate, acc_char_cmp,
	acc_char_index, search_line_acc_char, repl_chars, search_line_mmx,
	search_line_sse2, search_line_sse42, init_vectorized_lexer,
	search_line_fast): New.
	(_cpp_clean_line): Use search_line_fast.  Restructure the fast
	loop to make it clear when we're leaving the loop.  Stay in the
	fast loop for non-trigraph '?'.

Co-Authored-By: Andi Kleen <ak@linux.intel.com>
Co-Authored-By: David S. Miller <davem@davemloft.net>

From-SVN: r163446
2010-08-21 12:05:40 -07:00
Simon Baldwin 87cf065171 diagnostic.h (diagnostic_override_option_index): New macro to set a diagnostic's option_index.
* diagnostic.h (diagnostic_override_option_index): New macro to
	set a diagnostic's option_index.
	* c-tree.h (c_cpp_error): Add warning reason argument.
	* opts.c (_warning_as_error_callback): New.
	(register_warning_as_error_callback): Store callback for
	warnings enabled via enable_warning_as_error.
	(enable_warning_as_error): Call callback, minor code tidy.
	* opts.h (register_warning_as_error_callback): Declare.
	* c-opts.c (warning_as_error_callback): New, set cpp_opts flag in
	response to -Werror=.
	(c_common_init_options): Register warning_as_error_callback in opts.c.
	* common.opt: Add -Wno-cpp option.
	* c-common.c (struct reason_option_codes_t): Map cpp warning
	reason codes to gcc option indexes.
	* (c_option_controlling_cpp_error): New function, lookup the gcc
	option index for a cpp warning reason code.
	* (c_cpp_error): Add warning reason argument, call
	c_option_controlling_cpp_error for diagnostic_override_option_index.
	* doc/invoke.texi: Document -Wno-cpp.

	* cpp.c (cb_cpp_error): Add warning reason argument, set a value
	for diagnostic_override_option_index if CPP_W_WARNING_DIRECTIVE.

	* directives.c (do_diagnostic): Add warning reason argument,
	call appropriate error reporting function for code.
	(directive_diagnostics): Call specific warning functions with
	warning reason where appropriate.
	(do_error, do_warning, do_pragma_dependency): Add warning reason
	argument to do_diagnostic calls.
	* macro.c (_cpp_warn_if_unused_macro, enter_macro_context,
	_cpp_create_definition): Call specific warning functions with
        warning reason where appropriate.
	* Makefile.in: Add new diagnostic functions to gettext translations.
	* include/cpplib.h (struct cpp_callbacks): Add warning reason code
	to error callback.
	(CPP_DL_WARNING, CPP_DL_WARNING_SYSHDR, CPP_DL_PEDWARN, CPP_DL_ERROR,
	CPP_DL_ICE, CPP_DL_NOTE, CPP_DL_FATAL): Replace macros with enums.
	(CPP_W_NONE, CPP_W_DEPRECATED, CPP_W_COMMENTS,
	CPP_W_MISSING_INCLUDE_DIRS, CPP_W_TRIGRAPHS, CPP_W_MULTICHAR,
	CPP_W_TRADITIONAL, CPP_W_LONG_LONG, CPP_W_ENDIF_LABELS,
	CPP_W_NUM_SIGN_CHANGE, CPP_W_VARIADIC_MACROS,
	CPP_W_BUILTIN_MACRO_REDEFINED, CPP_W_DOLLARS, CPP_W_UNDEF,
	CPP_W_UNUSED_MACROS, CPP_W_CXX_OPERATOR_NAMES, CPP_W_NORMALIZE,
	CPP_W_INVALID_PCH, CPP_W_WARNING_DIRECTIVE): New enums for cpp
	warning reason codes.
	(cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
	cpp_warning_with_line, cpp_pedwarning_with_line,
	cpp_warning_with_line_syshdr): New specific error reporting functions.
	* pch.c (cpp_valid_state): Call specific warning functions with
        warning reason where appropriate.
	* errors.c (cpp_diagnostic, cpp_diagnostic_with_line): New central
	diagnostic handlers.
	(cpp_warning, cpp_pedwarning, cpp_warning_syshdr,
	cpp_warning_with_line, cpp_pedwarning_with_line,
	cpp_warning_with_line_syshdr): New specific error reporting functions.
	* expr.c (cpp_classify_number, eval_token, num_unary_op): Call
	specific warning functions with warning reason where appropriate.
	* lex.c (_cpp_process_line_notes, _cpp_skip_block_comment,
	warn_about_normalization, lex_identifier_intern, lex_identifier,
	_cpp_lex_direct): Ditto.
	* charset.c (_cpp_valid_ucn, convert_hex, convert_escape,
	narrow_str_to_charconst): Ditto.

	* gcc.dg/cpp/warn-undef-2.c: New.
	* gcc.dg/cpp/warn-traditional-2.c: New.
	* gcc.dg/cpp/warn-comments-2.c: New.
	* gcc.dg/cpp/warning-directive-1.c: New.
	* gcc.dg/cpp/warn-long-long.c: New.
	* gcc.dg/cpp/warn-traditional.c: New.
	* gcc.dg/cpp/warn-variadic-2.c: New.
	* gcc.dg/cpp/warn-undef.c: New.
	* gcc.dg/cpp/warn-normalized-1.c: New.
	* gcc.dg/cpp/warning-directive-2.c: New.
	* gcc.dg/cpp/warn-long-long-2.c: New.
	* gcc.dg/cpp/warn-variadic.c: New.
	* gcc.dg/cpp/warn-normalized-2.c: New.
	* gcc.dg/cpp/warning-directive-3.c: New.
	* gcc.dg/cpp/warn-deprecated-2.c: New.
	* gcc.dg/cpp/warn-trigraphs-1.c: New.
	* gcc.dg/cpp/warn-multichar-2.c: New.
	* gcc.dg/cpp/warn-normalized-3.c: New.
	* gcc.dg/cpp/warning-directive-4.c: New.
	* gcc.dg/cpp/warn-unused-macros.c: New.
	* gcc.dg/cpp/warn-trigraphs-2.c: New.
	* gcc.dg/cpp/warn-cxx-compat-2.c: New.
	* gcc.dg/cpp/warn-cxx-compat.c: New.
	* gcc.dg/cpp/warn-redefined.c: New.
	* gcc.dg/cpp/warn-trigraphs-3.c: New.
	* gcc.dg/cpp/warn-unused-macros-2.c: New.
	* gcc.dg/cpp/warn-deprecated.c: New.
	* gcc.dg/cpp/warn-trigraphs-4.c: New.
	* gcc.dg/cpp/warn-redefined-2.c: New.
	* gcc.dg/cpp/warn-comments.c: New.
	* gcc.dg/cpp/warn-multichar.c: New.
	* g++.dg/cpp/warning-directive-1.C: New.
	* g++.dg/cpp/warning-directive-2.C: New.
	* g++.dg/cpp/warning-directive-3.C: New.
	* g++.dg/cpp/warning-directive-4.C: New.
	* gfortran.dg/warning-directive-1.F90: New.
	* gfortran.dg/warning-directive-3.F90: New.
	* gfortran.dg/warning-directive-2.F90: New.
	* gfortran.dg/warning-directive-4.F90: New.

From-SVN: r158079
2010-04-07 17:18:10 +00:00
Jakub Jelinek d947ada0a1 re PR preprocessor/43642 (FAIL: c-c++-common/raw-string-1.c)
PR preprocessor/43642
	* lex.c (lex_raw_string): Change type of TYPE variable to
	unsigned char.

From-SVN: r157979
2010-04-06 09:02:40 +02:00
Jason Merrill 00a81b8b9d More N3077 raw string changes
More N3077 raw string changes
	* charset.c (cpp_interpret_string): Don't transform UCNs in raw
	strings.
	* lex.c (bufring_append): Split out from...
	(lex_raw_string): ...here.  Undo trigraph and line splicing
	transformations.  Do process line notes in multi-line literals.
	(_cpp_process_line_notes): Ignore notes that were already handled.

From-SVN: r157804
2010-03-29 16:07:29 -04:00
Jason Merrill 521506258f Some raw string changes from N3077
Some raw string changes from N3077
	* charset.c (cpp_interpret_string): Change inner delimiters to ().
	* lex.c (lex_raw_string): Likewise.  Also disallow '\' in delimiter.

From-SVN: r157797
2010-03-29 11:00:43 -04:00
Kai Tietz 17e7cb8550 ChangeLog for libcpp
2009-11-11  Kai Tietz  <kai.tietz@onevision.com>

	* directives.c (do_pragma_push_macro): New pragma handler.
	(do_pragma_pop_macro): Likewise.
	(_cpp_init_internal_pragmas): Add push_macro and
	pop_macro handler to internal pragmas.
	(lex_macro_node_from_str): Removed.
	(cpp_push_definition): Replace lex_macro_node_from_str
	by _cpp_lex_identifier.
	(cpp_pop_definition): Likewise.
	* internal.h (_cpp_lex_identifier): New prototype.
	(def_pragma_macro): New structure.
	(cpp_reader): New member pushed_macros.
	* lex.c (_cpp_lex_identifier): New function.
	(lex_identifier_intern): New function.
	* init.c (cpp_create_reader): Initialize pushed_macros
	member.
	(cpp_destroy): Free elements in pushed_macros member.
	* pch.c (_cpp_save_pushed_macros): New function.
	(_cpp_restore_pushed_macros): Likewise.
	(_cpp_restore_pushed_macros): Use _cpp_save_pushed_macros.
	(cpp_read_state): Use _cpp_restore_pushed_macros.

ChangeLog for gcc

2009-11-11  Kai Tietz  <kai.tietz@onevision.com>

	* config/i386/cygming.h (HANDLE_PRAGMA_PUSH_POP_MACRO):
	Removed.
	* c-pragma.c (def_pragma_macro_value): Likewise.
	(def_pragma_macro): Likewise.
	(pushed_macro_table): Likewise.
	(HANDLE_PRAGMA_PUSH_POP_MACRO): Remove guarded
	code.
	* doc/tm.texi (HANDLE_PRAGMA_PUSH_POP_MACRO):
	Removed.

ChangeLog for gcc/testsuite

2009-11-11  Kai Tietz  <kai.tietz@onevision.com>

	* g++.dg/torture/pushpop_macro.C: New testcase.
	* gcc.c-torture/execute/pushpop_macro.c: New testcase.
	* gcc.dg/cpp/pragma-pop_macro-1.c: Allow test for all
	targets.

From-SVN: r154098
2009-11-11 19:37:19 +01:00
Jakub Jelinek 2c6e3f5540 charset.c (cpp_init_iconv): Initialize utf8_cset_desc.
* charset.c (cpp_init_iconv): Initialize utf8_cset_desc.
	(_cpp_destroy_iconv): Destroy utf8_cset_desc, char16_cset_desc
	and char32_cset_desc.
	(converter_for_type): Handle CPP_UTF8STRING.
	(cpp_interpret_string): Handle CPP_UTF8STRING and raw-strings.
	* directives.c (get__Pragma_string): Handle CPP_UTF8STRING.
	(parse_include): Reject raw strings.
	* include/cpplib.h (CPP_UTF8STRING): New token type.
	* internal.h (struct cpp_reader): Add utf8_cset_desc field.
	* lex.c (lex_raw_string): New function.
	(lex_string): Handle u8 string literals, call lex_raw_string
	for raw string literals.
	(_cpp_lex_direct): Call lex_string even for u8" and {,u,U,L,u8}R"
	sequences.
	* macro.c (stringify_arg): Handle CPP_UTF8STRING.

	* c-common.c (c_parse_error): Handle CPP_UTF8STRING.
	* c-lex.c (c_lex_with_flags): Likewise.  Test C_LEX_STRING_NO_JOIN
	instead of C_LEX_RAW_STRINGS.
	(lex_string): Handle CPP_UTF8STRING.
	* c-parser.c (c_parser_postfix_expression): Likewise.
	* c-pragma.h (C_LEX_RAW_STRINGS): Rename to ...
	(C_LEX_STRING_NO_JOIN): ... this.

	* parser.c (cp_lexer_print_token, cp_parser_is_string_literal,
	cp_parser_string_literal, cp_parser_primary_expression): Likewise.
	(cp_lexer_get_preprocessor_token): Use C_LEX_STRING_JOIN instead
	of C_LEX_RAW_STRINGS.

	* gcc.dg/raw-string-1.c: New test.
	* gcc.dg/raw-string-2.c: New test.
	* gcc.dg/raw-string-3.c: New test.
	* gcc.dg/raw-string-4.c: New test.
	* gcc.dg/raw-string-5.c: New test.
	* gcc.dg/raw-string-6.c: New test.
	* gcc.dg/raw-string-7.c: New test.
	* gcc.dg/utf8-1.c: New test.
	* gcc.dg/utf8-2.c: New test.
	* gcc.dg/utf-badconcat2.c: New test.
	* gcc.dg/utf-dflt2.c: New test.
	* gcc.dg/cpp/include6.c: New test.
	* g++.dg/ext/raw-string-1.C: New test.
	* g++.dg/ext/raw-string-2.C: New test.
	* g++.dg/ext/raw-string-3.C: New test.
	* g++.dg/ext/raw-string-4.C: New test.
	* g++.dg/ext/raw-string-5.C: New test.
	* g++.dg/ext/raw-string-6.C: New test.
	* g++.dg/ext/raw-string-7.C: New test.
	* g++.dg/ext/utf8-1.C: New test.
	* g++.dg/ext/utf8-2.C: New test.
	* g++.dg/ext/utf-badconcat2.C: New test.
	* g++.dg/ext/utf-dflt2.C: New test.

From-SVN: r152995
2009-10-19 23:41:15 +02:00
Ian Lance Taylor 3d8b2a98ca cpplib.h (struct cpp_options): Add warn_cxx_operator_names field.
libcpp/:
	* include/cpplib.h (struct cpp_options): Add
	warn_cxx_operator_names field.
	(NODE_WARN_OPERATOR): Define.
	(struct cpp_hashnode): Increase flags field to 10 bits, decrease
	type to 6 bits.
	* init.c (mark_named_operators): Add flags parameter.
	(cpp_post_options): Pick flags value to pass to
	mark_named_operators.
	* lex.c (lex_identifier): If NODE_WARN_OPERATOR is set, warn that
	identifier is an operator name in C++.
gcc/:
	* fold-const.c (fold_unary): Rename local variable and to
	and_expr.
	* c-opts.c (c_common_handle_option): For -Wc++-compat set
	cpp_opts->warn_cxx_operator_names.
gcc/testsuite/:
	* gcc.dg/Wcxx-compat-13.c: New testcase.

From-SVN: r148438
2009-06-12 19:43:25 +00:00