aboutsummaryrefslogtreecommitdiff
path: root/libcpp/lex.c
AgeCommit message (Collapse)AuthorFilesLines
2014-10-13backport: lex.c (search_line_fast): Add new version to be used for Power8 ↵Bill Schmidt1-11/+104
and later targets when Altivec is enabled. 2014-10-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline r215873 2014-10-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * lex.c (search_line_fast): Add new version to be used for Power8 and later targets when Altivec is enabled. Restrict the existing Altivec version to big-endian systems so that lvsr is not used on little endian, where it is deprecated. Remove LE-specific code from the now-BE-only version. From-SVN: r216133
2014-04-04backport: rs6000.c (rs6000_expand_vec_perm_const_1): Correct for little endian.Bill Schmidt1-0/+9
[gcc] 2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline r205333 2013-11-24 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (rs6000_expand_vec_perm_const_1): Correct for little endian. Backport from mainline r205241 2013-11-21 Bill Schmidt <wschmidt@vnet.ibm.com> * config/rs6000/vector.md (vec_pack_trunc_v2df): Revert previous little endian change. (vec_pack_sfix_trunc_v2df): Likewise. (vec_pack_ufix_trunc_v2df): Likewise. * config/rs6000/rs6000.c (rs6000_expand_interleave): Correct double checking of endianness. Backport from mainline r205146 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vsx.md (vsx_set_<mode>): Adjust for little endian. (vsx_extract_<mode>): Likewise. (*vsx_extract_<mode>_one_le): New LE variant on *vsx_extract_<mode>_zero. (vsx_extract_v4sf): Adjust for little endian. Backport from mainline r205080 2013-11-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Adjust V16QI vector splat case for little endian. Backport from mainline r205045: 2013-11-19 Ulrich Weigand <Ulrich.Weigand@de.ibm.com> * config/rs6000/vector.md ("mov<mode>"): Do not call rs6000_emit_le_vsx_move to move into or out of GPRs. * config/rs6000/rs6000.c (rs6000_emit_le_vsx_move): Assert source and destination are not GPR hard regs. Backport from mainline r204920 2011-11-17 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (rs6000_frame_related): Add split_reg parameter and use it in REG_FRAME_RELATED_EXPR note. (emit_frame_save): Call rs6000_frame_related with extra NULL_RTX parameter. (rs6000_emit_prologue): Likewise, but for little endian VSX stores, pass the source register of the store instead. Backport from mainline r204862 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/altivec.md (UNSPEC_VPERM_X, UNSPEC_VPERM_UNS_X): Remove. (altivec_vperm_<mode>): Revert earlier little endian change. (*altivec_vperm_<mode>_internal): Remove. (altivec_vperm_<mode>_uns): Revert earlier little endian change. (*altivec_vperm_<mode>_uns_internal): Remove. * config/rs6000/vector.md (vec_realign_load_<mode>): Revise commentary. Backport from mainline r204441 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (rs6000_option_override_internal): Remove restriction against use of VSX instructions when generating code for little endian mode. Backport from mainline r204440 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/altivec.md (mulv4si3): Ensure we generate vmulouh for both big and little endian. (mulv8hi3): Swap input operands for merge high and merge low instructions for little endian. Backport from mainline r204439 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/altivec.md (vec_widen_umult_even_v16qi): Change define_insn to define_expand that uses even patterns for big endian and odd patterns for little endian. (vec_widen_smult_even_v16qi): Likewise. (vec_widen_umult_even_v8hi): Likewise. (vec_widen_smult_even_v8hi): Likewise. (vec_widen_umult_odd_v16qi): Likewise. (vec_widen_smult_odd_v16qi): Likewise. (vec_widen_umult_odd_v8hi): Likewise. (vec_widen_smult_odd_v8hi): Likewise. (altivec_vmuleub): New define_insn. (altivec_vmuloub): Likewise. (altivec_vmulesb): Likewise. (altivec_vmulosb): Likewise. (altivec_vmuleuh): Likewise. (altivec_vmulouh): Likewise. (altivec_vmulesh): Likewise. (altivec_vmulosh): Likewise. Backport from mainline r204395 2013-11-05 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vector.md (vec_pack_sfix_trunc_v2df): Adjust for little endian. (vec_pack_ufix_trunc_v2df): Likewise. Backport from mainline r204363 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/altivec.md (vec_widen_umult_hi_v16qi): Swap arguments to merge instruction for little endian. (vec_widen_umult_lo_v16qi): Likewise. (vec_widen_smult_hi_v16qi): Likewise. (vec_widen_smult_lo_v16qi): Likewise. (vec_widen_umult_hi_v8hi): Likewise. (vec_widen_umult_lo_v8hi): Likewise. (vec_widen_smult_hi_v8hi): Likewise. (vec_widen_smult_lo_v8hi): Likewise. Backport from mainline r204350 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vsx.md (*vsx_le_perm_store_<mode> for VSX_D): Replace the define_insn_and_split with a define_insn and two define_splits, with the split after reload re-permuting the source register to its original value. (*vsx_le_perm_store_<mode> for VSX_W): Likewise. (*vsx_le_perm_store_v8hi): Likewise. (*vsx_le_perm_store_v16qi): Likewise. Backport from mainline r204321 2013-11-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vector.md (vec_pack_trunc_v2df): Adjust for little endian. Backport from mainline r204321 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com> * config/rs6000/rs6000.c (rs6000_expand_vector_set): Adjust for little endian. Backport from mainline r203980 2013-10-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/altivec.md (mulv8hi3): Adjust for little endian. Backport from mainline r203930 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse meaning of merge-high and merge-low masks for little endian; avoid use of vector-pack masks for little endian for mismatched modes. Backport from mainline r203877 2013-10-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/altivec.md (vec_unpacku_hi_v16qi): Adjust for little endian. (vec_unpacku_hi_v8hi): Likewise. (vec_unpacku_lo_v16qi): Likewise. (vec_unpacku_lo_v8hi): Likewise. Backport from mainline r203863 2013-10-19 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (vspltis_constant): Make sure we check all elements for both endian flavors. Backport from mainline r203714 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc/config/rs6000/vector.md (vec_unpacks_hi_v4sf): Correct for endianness. (vec_unpacks_lo_v4sf): Likewise. (vec_unpacks_float_hi_v4si): Likewise. (vec_unpacks_float_lo_v4si): Likewise. (vec_unpacku_float_hi_v4si): Likewise. (vec_unpacku_float_lo_v4si): Likewise. Backport from mainline r203713 2013-10-16 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vsx.md (vsx_concat_<mode>): Adjust output for LE. (vsx_concat_v2sf): Likewise. Backport from mainline r203458 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): Generalize to handle vector float as well. (*vsx_le_perm_load_v4si): Likewise. (*vsx_le_perm_store_v2di): Likewise. (*vsx_le_perm_store_v4si): Likewise. Backport from mainline r203457 2013-10-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vector.md (vec_realign_load<mode>): Generate vperm directly to circumvent subtract from splat{31} workaround. * config/rs6000/rs6000-protos.h (altivec_expand_vec_perm_le): New prototype. * config/rs6000/rs6000.c (altivec_expand_vec_perm_le): New. * config/rs6000/altivec.md (define_c_enum "unspec"): Add UNSPEC_VPERM_X and UNSPEC_VPERM_UNS_X. (altivec_vperm_<mode>): Convert to define_insn_and_split to separate big and little endian logic. (*altivec_vperm_<mode>_internal): New define_insn. (altivec_vperm_<mode>_uns): Convert to define_insn_and_split to separate big and little endian logic. (*altivec_vperm_<mode>_uns_internal): New define_insn. (vec_permv16qi): Add little endian logic. Backport from mainline r203247 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const_le): New. (altivec_expand_vec_perm_const): Call it. Backport from mainline r203246 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * config/rs6000/vector.md (mov<mode>): Emit permuted move sequences for LE VSX loads and stores at expand time. * config/rs6000/rs6000-protos.h (rs6000_emit_le_vsx_move): New prototype. * config/rs6000/rs6000.c (rs6000_const_vec): New. (rs6000_gen_le_vsx_permute): New. (rs6000_gen_le_vsx_load): New. (rs6000_gen_le_vsx_store): New. (rs6000_gen_le_vsx_move): New. * config/rs6000/vsx.md (*vsx_le_perm_load_v2di): New. (*vsx_le_perm_load_v4si): New. (*vsx_le_perm_load_v8hi): New. (*vsx_le_perm_load_v16qi): New. (*vsx_le_perm_store_v2di): New. (*vsx_le_perm_store_v4si): New. (*vsx_le_perm_store_v8hi): New. (*vsx_le_perm_store_v16qi): New. (*vsx_xxpermdi2_le_<mode>): New. (*vsx_xxpermdi4_le_<mode>): New. (*vsx_xxpermdi8_le_V8HI): New. (*vsx_xxpermdi16_le_V16QI): New. (*vsx_lxvd2x2_le_<mode>): New. (*vsx_lxvd2x4_le_<mode>): New. (*vsx_lxvd2x8_le_V8HI): New. (*vsx_lxvd2x16_le_V16QI): New. (*vsx_stxvd2x2_le_<mode>): New. (*vsx_stxvd2x4_le_<mode>): New. (*vsx_stxvd2x8_le_V8HI): New. (*vsx_stxvd2x16_le_V16QI): New. Backport from mainline r201235 2013-07-24 Bill Schmidt <wschmidt@linux.ibm.com> Anton Blanchard <anton@au1.ibm.com> * config/rs6000/altivec.md (altivec_vpkpx): Handle little endian. (altivec_vpks<VI_char>ss): Likewise. (altivec_vpks<VI_char>us): Likewise. (altivec_vpku<VI_char>us): Likewise. (altivec_vpku<VI_char>um): Likewise. Backport from mainline r201208 2013-07-24 Bill Schmidt <wschmidt@vnet.linux.ibm.com> Anton Blanchard <anton@au1.ibm.com> * config/rs6000/vector.md (vec_realign_load_<mode>): Reorder input operands to vperm for little endian. * config/rs6000/rs6000.c (rs6000_expand_builtin): Use lvsr instead of lvsl to create the control mask for a vperm for little endian. Backport from mainline r201195 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Anton Blanchard <anton@au1.ibm.com> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Reverse two operands for little-endian. Backport from mainline r201193 2013-07-23 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Anton Blanchard <anton@au1.ibm.com> * config/rs6000/rs6000.c (altivec_expand_vec_perm_const): Correct selection of field for vector splat in little endian mode. Backport from mainline r201149 2013-07-22 Bill Schmidt <wschmidt@vnet.linux.ibm.com> Anton Blanchard <anton@au1.ibm.com> * config/rs6000/rs6000.c (rs6000_expand_vector_init): Fix endianness when selecting field to splat. [gcc/testsuite] 2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline r205638 2013-12-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.dg/vect/costmodel/ppc/costmodel-slp-34.c: Skip for little endian. Backport from mainline r205146 2013-11-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/pr48258-1.c: Skip for little endian. Backport from mainline r204862 2013-11-15 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.dg/vmx/3b-15.c: Revise for little endian. Backport from mainline r204321 2013-11-02 Bill Schmidt <wschmidt@vnet.linux.ibm.com> * gcc.dg/vmx/vec-set.c: New. Backport from mainline r204138 2013-10-28 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.dg/vmx/gcc-bug-i.c: Add little endian variant. * gcc.dg/vmx/eg-5.c: Likewise. Backport from mainline r203930 2013-10-22 Bill Schmidt <wschmidt@vnet.ibm.com> * gcc.target/powerpc/altivec-perm-1.c: Move the two vector pack tests into... * gcc.target/powerpc/altivec-perm-3.c: ...this new test, which is restricted to big-endian targets. Backport from mainline r203246 2013-10-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * gcc.target/powerpc/pr43154.c: Skip for ppc64 little endian. * gcc.target/powerpc/fusion.c: Likewise. [libcpp] 2014-04-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> Backport from mainline 2013-11-18 Bill Schmidt <wschmidt@linux.vnet.ibm.com> * lex.c (search_line_fast): Correct for little endian. From-SVN: r209094
2013-02-28configure.ac: Don't define ENABLE_CHECKING whenever --enable-checking is seen...Jakub Jelinek1-0/+13
* 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-14re PR c++/55582 ([C++11] Unable to define string user-defined literal ↵Ed Smith-Rowland1-6/+10
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-01-14Update copyright years in libcpp.Richard Sandiford1-2/+1
From-SVN: r195162
2013-01-04PR c++/54526 (again)Paolo Carlini1-2/+13
/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
2012-10-15files.c (read_file_guts, [...]): Free memory before returning.Tobias Burnus1-0/+1
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-06-19lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and ↵Uros Bizjak1-2/+5
__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-05-29PR bootstrap/53459 - unused local typedef when building on altivecDodji Seketeli1-2/+2
PR bootstrap/53459 * lex.c (search_line_fast): Avoid unused local typedefs to simulate a static assertion. From-SVN: r187947
2012-05-29Revert "PR bootstrap/53459 - unused local typedef when building on altivec"Dodji Seketeli1-0/+1
This reverts commit r187853 From-SVN: r187946
2012-05-24PR bootstrap/53459 - unused local typedef when building on altivecDodji Seketeli1-1/+0
libcpp/ PR bootstrap/53459 * lex.c (search_line_fast): Remove unused typedef check_count. From-SVN: r187853
2012-04-29Don't use C++ style comments in libcppDodji Seketeli1-2/+2
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-27Add new option, -Wliteral-suffix.Ollie Wild1-6/+38
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-03-22* lex.c (search_line_fast): Provide Neon-optimized version for ARM.Richard Earnshaw1-0/+63
From-SVN: r185702
2012-03-14Remove obsolete Solaris 8 supportRainer Orth1-2/+1
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
2011-12-07re PR bootstrap/50237 (bootstrap comparison failure for libcpp/lex.o)Jakub Jelinek1-1/+12
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-10-26Implement C++11 user-defined literals.Ed Smith-Rowland1-0/+25
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-22Fix cpp_peek_token behaviour (PR bootstrap/50778)Dodji Seketeli1-9/+7
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-20Fix thinko in _cpp_remaining_tokens_num_in_contextDodji Seketeli1-4/+2
libcpp/ * lex.c (_cpp_remaining_tokens_num_in_context): Fix computation of number of tokens. From-SVN: r180239
2011-10-17Generate virtual locations for tokensTom Tromey1-7/+34
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-08-22Add ability to force lexed tokens' source_locations.Gabriel Charette1-2/+23
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-18c1x-uni-string-1.c, [...]: New tests.Joseph Myers1-5/+7
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-15LINEMAP_POSITION_FOR_COLUMN had the exact same effect as ↵Gabriel Charette1-2/+2
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-06-16re PR c++/45399 ([C++0x] Warning for \0 in raw strings)Jason Merrill1-8/+0
PR c++/45399 * lex.c (lex_raw_string): Don't check for embedded NUL. From-SVN: r175121
2011-05-22* lex.c (init_vectorized_lexer): Fix comparison of masked value.Uros Bizjak1-1/+2
From-SVN: r174037
2011-05-22re PR bootstrap/49104 (bootstrap failure on AMD K6-2 with illegal ↵Uros Bizjak1-3/+3
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-04-24re PR preprocessor/48740 (Raw C++0x strings and trigraphs mix badly)Jakub Jelinek1-1/+3
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-03-18re PR bootstrap/45381 (Bootstrap failure for powerpc-apple-darwin9: error: ↵Richard Henderson1-1/+1
AltiVec argument passed to unprototyped function) PR bootstrap/45381 * lex.c [ALTIVEC] (search_line_fast): Require gcc version 4.5. From-SVN: r171165
2010-11-16re PR preprocessor/17349 (// comments cause weird behaviour with options -E -C)Kai Tietz1-6/+12
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-08-24re PR bootstrap/45376 (no such instruction: `pcmpestri $0,(%rdi),%xmm0')Richard Henderson1-0/+6
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-24lex.c: Disable init_vectorized_lexer etc.Rainer Orth1-1/+11
* lex.c [__sun__ && __svr4__]: Disable init_vectorized_lexer etc. on Solaris 2/x86. From-SVN: r163522
2010-08-21Vectorize fast path of _cpp_clean_line.Richard Henderson1-56/+589
* 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-04-07diagnostic.h (diagnostic_override_option_index): New macro to set a ↵Simon Baldwin1-20/+23
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-06re PR preprocessor/43642 (FAIL: c-c++-common/raw-string-1.c)Jakub Jelinek1-1/+1
PR preprocessor/43642 * lex.c (lex_raw_string): Change type of TYPE variable to unsigned char. From-SVN: r157979
2010-03-29More N3077 raw string changesJason Merrill1-30/+131
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-29Some raw string changes from N3077Jason Merrill1-5/+5
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
2009-11-11ChangeLog for libcppKai Tietz1-0/+57
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-10-19charset.c (cpp_init_iconv): Initialize utf8_cset_desc.Jakub Jelinek1-10/+213
* 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-06-12cpplib.h (struct cpp_options): Add warn_cxx_operator_names field.Ian Lance Taylor1-0/+6
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-05-10c-lex.c (c_lex_with_flags): Expect cpp_hashnode in tok->val.node.node.Joseph Myers1-23/+24
gcc: * c-lex.c (c_lex_with_flags): Expect cpp_hashnode in tok->val.node.node. libcpp: * include/cpplib.h (enum cpp_token_fld_kind): Add CPP_TOKEN_FLD_TOKEN_NO. (struct cpp_macro_arg, struct cpp_identifier): Define. (union cpp_token_u): Use struct cpp_identifier for identifiers. Use struct cpp_macro_arg for macro arguments. Add token_no for CPP_PASTE token numbers. * directives.c (_cpp_handle_directive, lex_macro_node, do_pragma, do_pragma_poison, parse_assertion): Use val.node.node in place of val.node. * expr.c (parse_defined, eval_token): Use val.node.node in place of val.node. * lex.c (cpp_ideq, _cpp_lex_direct, cpp_token_len, cpp_spell_token, cpp_output_token, _cpp_equiv_tokens, cpp_token_val_index): Use val.macro_arg.arg_no or val.token_no in place of val.arg_no. Use val.node.node in place of val.node. * macro.c (replace_args, cpp_get_token, parse_params, lex_expansion_token, create_iso_definition, cpp_macro_definition): Use val.macro_arg.arg_no or val.token_no in place of val.arg_no. Use val.node.node in place of val.node. From-SVN: r147341
2009-04-22re PR c++/14875 (When using 'or' keyword, the error message speaks of a '||' ↵Manuel López-Ibáñez1-7/+18
token) 2009-04-22 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR c++/14875 * c-common.c (c_parse_error): Take a token_flags parameter. Use token_type for the token type instead. Pass token_flags to cpp_type2name. * c-common.h (c_parse_error): Update declaration. * c-parser.c (c_parser_error): Pass 0 as token flags. libcpp/ * lex.c (cpp_type2name): Take a flags parameter. Call cpp_named_operator2name for named operators and cpp_digraph2name for digraphs. (cpp_digraph2name): New. (cpp_spell_token): Use it. (cpp_output_token): Likewise. * include/cpplib.h (cpp_type2name): Update declaration. * init.c (cpp_named_operator2name): New. * internal.h (cpp_named_operator2name): Declare. cp/ * parser.c (cp_parser_error): Pass token->flags to c_parse_error. testsuite/ * g++.dg/parse/parser-pr14875.C: New. * g++.dg/parse/parser-pr14875-2.C: New. * g++.dg/parse/error6.C: Update match string. From-SVN: r146589
2009-04-19re PR preprocessor/20078 (Gcc doesn't complain about non-benign macro ↵Joseph Myers1-3/+10
definitions) libcpp: PR preprocessor/20078 * include/cpp-id-data.h (struct cpp_macro): Add extra_tokens field. * include/cpplib.h (SP_DIGRAPH, SP_PREV_WHITE): Define. (struct cpp_token): Change flags to unsigned short. * lex.c (_cpp_lex_direct): Initialize arg_no for CPP_PASTE tokens. (_cpp_equiv_tokens): Check arg_no for CPP_PASTE tokens. (cpp_token_val_index): Return CPP_TOKEN_FLD_ARG_NO for CPP_PASTE tokens. * macro.c (macro_real_token_count): New. (enter_macro_context, replace_args): Use macro_real_token_count. (create_iso_definition): Record whitespace surrounding and digraph spelling of # and ## tokens using SP_PREV_WHITE and SP_DIGRAPH. Set extra_tokens and save CPP_PASTE tokens with arg_no set for multiple consecutive ## tokens. (_cpp_create_definition): Initialize extra_tokens. (cpp_macro_definition): Use macro_real_token_count. gcc/testsuite: * gcc.dg/cpp/paste16.c, gcc.dg/cpp/redef4.c: New tests. From-SVN: r146352
2009-04-09Licensing changes to GPLv3 resp. GPLv3 with GCC Runtime Exception.Jakub Jelinek1-4/+5
From-SVN: r145841
2009-02-21lex.c (lex_string): Return a CPP_LESS token for missing '>' in a header name.Joseph Myers1-2/+13
libcpp: * lex.c (lex_string): Return a CPP_LESS token for missing '>' in a header name. (_cpp_lex_direct): Handle this. gcc/testsuite: * gcc.dg/cpp/include4.c: New test. From-SVN: r144361
2008-11-29lex.c (cpp_token_len): Use 6 as default length.Joseph Myers1-1/+1
libcpp: * lex.c (cpp_token_len): Use 6 as default length. gcc/testsuite: * g++.dg/cpp/stringop-1.C: New test. From-SVN: r142275
2008-10-05cpplib.h (cpp_comments, [...]): New structs.Matthew Gingell1-0/+49
2008-10-05 Matthew Gingell <gingell@adacore.com> Arnaud Charlet <charlet@adacore.com> * include/cpplib.h (cpp_comments, cpp_comment_table): New structs. (cpp_get_comments): New function. * internal.h (struct cpp_reader): Add comments field. * init.c (cpp_destroy): Free comments. * lex.c (store_comment, cpp_get_comments): New functions. (comments): New struct. (save_comment): Store comments in comments struct. Co-Authored-By: Arnaud Charlet <charlet@adacore.com> From-SVN: r140883
2008-07-21line-map.h (linenum_type): New typedef.Manuel López-Ibáñez1-1/+1
2008-07-21 Manuel Lopez-Ibanez <manu@gcc.gnu.org> * include/line-map.h (linenum_type): New typedef. (struct line_map): Use it. (SOURCE_LINE): Second arguments is a LOCATION not a LINE. (SOURCE_COLUMN): Likewise. * macro.c (_cpp_builtin_macro_text): Use linenum_type. Don't store source_location values in a variable of type linenum_type. * directives.c (struct if_stack): Use linenum_type. (strtoul_for_line): Rename as strtolinenum. (do_line): Use linenum_type. (do_linemarker): Use linenum_type and strtolinenum. (_cpp_do_file_change): Use linenum_t. * line-map.c (linemap_add): Likewise. (linemap_line_start): Likewise. * traditional.c (struct fun_macro): 'line' is a source_location. * errors.c (print_location): Use linenum_type. * directives-only.c (_cpp_preprocess_dir_only): Likewise. * internal.h (CPP_INCREMENT_LINE): Likewise. * lex.c (_cpp_skip_block_comment): Use source_location. From-SVN: r138026
2008-07-14cpplib.h (NODE_CONDITIONAL): New.Ben Elliston1-1/+65
libcpp/ * include/cpplib.h (NODE_CONDITIONAL): New. (struct cpp_callbacks): New macro_to_expand field. (struct cpp_hashnode): Adjust size of flags and type fields. (cpp_peek_token): Prototype. * lex.c (cpp_peek_token): New function. (_cpp_temp_token): Protect pre-existing lookaheads. * macro.c (cpp_get_token): Expand any conditional macros. (_cpp_backup_tokens_direct): New. (_cpp_backup_tokens): Call _cpp_backup_tokens_direct. (warn_of_redefinition): Silently allow redefined conditional macros. (_cpp_create_definition): Remove the conditional flag when a user defines one of the conditional macros. * internal.h (_cpp_backup_tokens_direct): New prototype. gcc/ * c-common.h (C_CPP_HASHNODE): New macro. * coretypes.h (struct cpp_token): Forward declare. * doc/extend.texi (PowerPC AltiVec Built-in Functions): Document the context-sensitive keyword method. * config/rs6000/rs6000-c.c (__vector_keyword, vector_keyword, __pixel_keyword, pixel_keyword, __bool_keyword, bool_keyword, expand_bool_pixel): New. (altivec_categorize_keyword): New function. (init_vector_keywords): New function. (rs6000_macro_to_expand): Likewise. (rs6000_cpu_cpp_builtins): Enable context-sensitive macros if not compiling an ISO C dialect. gcc/testsuite/ * gcc.target/powerpc/altivec-macros.c: New test. * gcc.target/powerpc/altviec-26.c: Likewise. * gcc.dg/vmx/1b-06.c: Remove bool variable. * gcc.dg/vmx/1b-07.c: Likewise. * gcc.dg/vmx/1b-06-ansi.c: New test for the pre-define method. * gcc.dg/vmx/1b-07-ansi.c: Likewise. From-SVN: r137775
2008-05-21re PR preprocessor/27777 (Bad diagnostic emission when #error contains a ↵Tom Tromey1-1/+46
trigraph) gcc/testsuite PR preprocessor/27777: * gcc.dg/cpp/pr27777.c: New file. libcpp PR preprocessor/27777: * lex.c (cpp_output_line_to_string): New function. * internal.h (_cpp_begin_message): Don't declare. * errors.c (_cpp_begin_message): Now static. * include/cpplib.h (cpp_output_line_to_string): Declare. * directives.c (do_diagnostic): Rewrote. Use cpp_output_line_to_string. Don't use _cpp_begin_message. From-SVN: r135740
2008-04-18cpp-id-data.h (UC): Was U, conflicts with U...Kris Van Hees1-14/+23
libcpp/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * include/cpp-id-data.h (UC): Was U, conflicts with U... literal. * include/cpplib.h (CHAR16, CHAR32, STRING16, STRING32): New tokens. (struct cpp_options): Added uliterals. (cpp_interpret_string): Update prototype. (cpp_interpret_string_notranslate): Idem. * charset.c (init_iconv_desc): New width member in cset_converter. (cpp_init_iconv): Add support for char{16,32}_cset_desc. (convert_ucn): Idem. (emit_numeric_escape): Idem. (convert_hex): Idem. (convert_oct): Idem. (convert_escape): Idem. (converter_for_type): New function. (cpp_interpret_string): Use converter_for_type, support u and U prefix. (cpp_interpret_string_notranslate): Match changed prototype. (wide_str_to_charconst): Use converter_for_type. (cpp_interpret_charconst): Add support for CPP_CHAR{16,32}. * directives.c (linemarker_dir): Macro U changed to UC. (parse_include): Idem. (register_pragma_1): Idem. (restore_registered_pragmas): Idem. (get__Pragma_string): Support CPP_STRING{16,32}. * expr.c (eval_token): Support CPP_CHAR{16,32}. * init.c (struct lang_flags): Added uliterals. (lang_defaults): Idem. * internal.h (struct cset_converter) <width>: New field. (struct cpp_reader) <char16_cset_desc>: Idem. (struct cpp_reader) <char32_cset_desc>: Idem. * lex.c (digraph_spellings): Macro U changed to UC. (OP, TK): Idem. (lex_string): Add support for u'...', U'...', u... and U.... (_cpp_lex_direct): Idem. * macro.c (_cpp_builtin_macro_text): Macro U changed to UC. (stringify_arg): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. gcc/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * c-common.c (CHAR16_TYPE, CHAR32_TYPE): New macros. (fname_as_string): Match updated cpp_interpret_string prototype. (fix_string_type): Support char16_t* and char32_t*. (c_common_nodes_and_builtins): Add char16_t and char32_t (and derivative) nodes. Register as builtin if C++0x. (c_parse_error): Support CPP_CHAR{16,32}. * c-common.h (RID_CHAR16, RID_CHAR32): New elements. (enum c_tree_index) <CTI_CHAR16_TYPE, CTI_SIGNED_CHAR16_TYPE, CTI_UNSIGNED_CHAR16_TYPE, CTI_CHAR32_TYPE, CTI_SIGNED_CHAR32_TYPE, CTI_UNSIGNED_CHAR32_TYPE, CTI_CHAR16_ARRAY_TYPE, CTI_CHAR32_ARRAY_TYPE>: New elements. (char16_type_node, signed_char16_type_node, unsigned_char16_type_node, char32_type_node, signed_char32_type_node, char16_array_type_node, char32_array_type_node): New defines. * c-lex.c (cb_ident): Match updated cpp_interpret_string prototype. (c_lex_with_flags): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. (lex_string): Support CPP_STRING{16,32}, match updated cpp_interpret_string and cpp_interpret_string_notranslate prototypes. (lex_charconst): Support CPP_CHAR{16,32}. * c-parser.c (c_parser_postfix_expression): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. gcc/cp/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * cvt.c (type_promotes_to): Support char16_t and char32_t. * decl.c (grokdeclarator): Disallow signed/unsigned/short/long on char16_t and char32_t. * lex.c (reswords): Add char16_t and char32_t (for c++0x). * mangle.c (write_builtin_type): Mangle char16_t/char32_t as vendor extended builtin type u8char32_t. * parser.c (cp_lexer_next_token_is_decl_specifier_keyword): Support RID_CHAR{16,32}. (cp_lexer_print_token): Support CPP_STRING{16,32}. (cp_parser_is_string_literal): Idem. (cp_parser_string_literal): Idem. (cp_parser_primary_expression): Support CPP_CHAR{16,32} and CPP_STRING{16,32}. (cp_parser_simple_type_specifier): Support RID_CHAR{16,32}. * tree.c (char_type_p): Support char16_t and char32_t as char types. * typeck.c (string_conv_p): Support char16_t and char32_t. gcc/testsuite/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> Tests for char16_t and char32_t support. * g++.dg/ext/utf-cvt.C: New * g++.dg/ext/utf-cxx0x.C: New * g++.dg/ext/utf-cxx98.C: New * g++.dg/ext/utf-dflt.C: New * g++.dg/ext/utf-gnuxx0x.C: New * g++.dg/ext/utf-gnuxx98.C: New * g++.dg/ext/utf-mangle.C: New * g++.dg/ext/utf-typedef-cxx0x.C: New * g++.dg/ext/utf-typedef- * g++.dg/ext/utf-typespec.C: New * g++.dg/ext/utf16-1.C: New * g++.dg/ext/utf16-2.C: New * g++.dg/ext/utf16-3.C: New * g++.dg/ext/utf16-4.C: New * g++.dg/ext/utf32-1.C: New * g++.dg/ext/utf32-2.C: New * g++.dg/ext/utf32-3.C: New * g++.dg/ext/utf32-4.C: New * gcc.dg/utf-cvt.c: New * gcc.dg/utf-dflt.c: New * gcc.dg/utf16-1.c: New * gcc.dg/utf16-2.c: New * gcc.dg/utf16-3.c: New * gcc.dg/utf16-4.c: New * gcc.dg/utf32-1.c: New * gcc.dg/utf32-2.c: New * gcc.dg/utf32-3.c: New * gcc.dg/utf32-4.c: New libiberty/ChangeLog: 2008-04-14 Kris Van Hees <kris.van.hees@oracle.com> * testsuite/demangle-expected: Added tests for char16_t and char32_t. From-SVN: r134438