1. 01 Jan, 2019 1 commit
  2. 27 Nov, 2018 2 commits
    • PR preprocessor/83173: Enhance -fdump-internal-locations output · bc65bad2
      gcc/ChangeLog:
      2018-11-27  Mike Gulick  <mgulick@mathworks.com>
      
      	PR preprocessor/83173
      	* input.c (dump_location_info): Dump reason and included_from
      	fields from line_map_ordinary struct.  Fix indentation when
      	location > 5 digits.
      	* diagnostic-show-locus.c (num_digits, num_digits): Move to
      	diagnostic.c to allow it to be utilized by input.c.
      	* diagnostic.c (num_digits, selftest::test_num_digits): Moved
      	here.
      	(selftest::diagnostic_c_tests): Run selftest::test_num_digits.
      	* diagnostic.h (num_digits): Add extern definition.
      
      libcpp/ChangeLog:
      2018-11-27  Mike Gulick  <mgulick@mathworks.com>
      
      	PR preprocessor/83173
      	* location-example.txt: Update example -fdump-internal-locations
      	output.
      
      From-SVN: r266520
      Mike Gulick committed
    • PR preprocessor/83173: Additional check before decrementing highest_location · 56c79e7f
      2018-11-27  Mike Gulick  <mgulick@mathworks.com>
      
      	PR preprocessor/83173
      	* files.c (_cpp_stack_include): Check if
      	line_table->highest_location is past current line before
      	decrementing.
      
      From-SVN: r266516
      Mike Gulick committed
  3. 13 Nov, 2018 1 commit
    • Eliminate source_location in favor of location_t · 620e594b
      Historically GCC used location_t, while libcpp used source_location.
      
      This inconsistency has been annoying me for a while, so this patch
      removes source_location in favor of location_t throughout
      (as the latter is shorter).
      
      gcc/ChangeLog:
      	* builtins.c: Replace "source_location" with "location_t".
      	* diagnostic-show-locus.c: Likewise.
      	* diagnostic.c: Likewise.
      	* dumpfile.c: Likewise.
      	* gcc-rich-location.h: Likewise.
      	* genmatch.c: Likewise.
      	* gimple.h: Likewise.
      	* gimplify.c: Likewise.
      	* input.c: Likewise.
      	* input.h: Likewise.  Eliminate the typedef.
      	* omp-expand.c: Likewise.
      	* selftest.h: Likewise.
      	* substring-locations.h (get_source_location_for_substring):
      	Rename to..
      	(get_location_within_string): ...this.
      	* tree-cfg.c: Replace "source_location" with "location_t".
      	* tree-cfgcleanup.c: Likewise.
      	* tree-diagnostic.c: Likewise.
      	* tree-into-ssa.c: Likewise.
      	* tree-outof-ssa.c: Likewise.
      	* tree-parloops.c: Likewise.
      	* tree-phinodes.c: Likewise.
      	* tree-phinodes.h: Likewise.
      	* tree-ssa-loop-ivopts.c: Likewise.
      	* tree-ssa-loop-manip.c: Likewise.
      	* tree-ssa-phiopt.c: Likewise.
      	* tree-ssa-phiprop.c: Likewise.
      	* tree-ssa-threadupdate.c: Likewise.
      	* tree-ssa.c: Likewise.
      	* tree-ssa.h: Likewise.
      	* tree-vect-loop-manip.c: Likewise.
      
      gcc/c-family/ChangeLog:
      	* c-common.c (c_get_substring_location): Update for renaming of
      	get_source_location_for_substring to get_location_within_string.
      	* c-lex.c: Replace "source_location" with "location_t".
      	* c-opts.c: Likewise.
      	* c-ppoutput.c: Likewise.
      
      gcc/c/ChangeLog:
      	* c-decl.c: Replace "source_location" with "location_t".
      	* c-tree.h: Likewise.
      	* c-typeck.c: Likewise.
      	* gimple-parser.c: Likewise.
      
      gcc/cp/ChangeLog:
      	* call.c: Replace "source_location" with "location_t".
      	* cp-tree.h: Likewise.
      	* cvt.c: Likewise.
      	* name-lookup.c: Likewise.
      	* parser.c: Likewise.
      	* typeck.c: Likewise.
      
      gcc/fortran/ChangeLog:
      	* cpp.c: Replace "source_location" with "location_t".
      	* gfortran.h: Likewise.
      
      gcc/go/ChangeLog:
      	* go-gcc-diagnostics.cc: Replace "source_location" with "location_t".
      	* go-gcc.cc: Likewise.
      	* go-linemap.cc: Likewise.
      	* go-location.h: Likewise.
      	* gofrontend/README: Likewise.
      
      gcc/jit/ChangeLog:
      	* jit-playback.c: Replace "source_location" with "location_t".
      
      gcc/testsuite/ChangeLog:
      	* g++.dg/plugin/comment_plugin.c: Replace "source_location" with
      	"location_t".
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Likewise.
      
      libcc1/ChangeLog:
      	* libcc1plugin.cc: Replace "source_location" with "location_t".
      	(plugin_context::get_source_location): Rename to...
      	(plugin_context::get_location_t): ...this.
      	* libcp1plugin.cc: Likewise.
      
      libcpp/ChangeLog:
      	* charset.c: Replace "source_location" with "location_t".
      	* directives-only.c: Likewise.
      	* directives.c: Likewise.
      	* errors.c: Likewise.
      	* expr.c: Likewise.
      	* files.c: Likewise.
      	* include/cpplib.h: Likewise.  Rename MAX_SOURCE_LOCATION to
      	MAX_LOCATION_T.
      	* include/line-map.h: Likewise.
      	* init.c: Likewise.
      	* internal.h: Likewise.
      	* lex.c: Likewise.
      	* line-map.c: Likewise.
      	* location-example.txt: Likewise.
      	* macro.c: Likewise.
      	* pch.c: Likewise.
      	* traditional.c: Likewise.
      
      From-SVN: r266085
      David Malcolm committed
  4. 07 Nov, 2018 1 commit
  5. 05 Nov, 2018 3 commits
  6. 31 Oct, 2018 7 commits
    • Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). · 22e05272
      This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
      (That's not the latest automake version, but it's the one used by
      binutils-gdb, with which consistency is desirable, and in any case
      seems a useful incremental update that should make a future update to
      1.16.1 easier.)
      
      The changes are generally similar to the binutils-gdb ones, and are
      copied from there where shared files and directories are involved
      (there are some further changes to such shared directories, however,
      which I'd expect to apply to binutils-gdb once this patch is in GCC).
      Largely, obsolete AC_PREREQ calls are removed, while many
      AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
      autoconf.  Multilib support is no longer included in core automake,
      meaning that multilib.am needs copying from automake's contrib
      directory into the GCC source tree.  Autoconf 2.69 has Go support, so
      local copies of that support are removed.  I hope the D support will
      soon be submitted to upstream autoconf so the local copy of that can
      be removed in a future update.  Changes to how automake generates
      runtest calls mean quotes are removed from RUNTEST definitions in five
      lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
      libphobos, libvtv; some others have RUNTEST definitions without
      quotes, which are still OK); libgo and libphobos also get
      -Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
      do not generate automake warnings.
      
      Note that the regeneration did not include regeneration of
      fixincludes/config.h.in (attempting such regeneration resulted in all
      the USED_FOR_TARGET conditionals disappearing; and I don't see
      anything in the fixincludes/ directory that would result in such
      conditionals being generated, unlike in the gcc/ directory).  Also
      note that libvtv/testsuite/other-tests/Makefile.in was not
      regenerated; that directory is not listed as a subdirectory for which
      Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
      not sure how it's meant to be regenerated.
      
      While I mostly fixed warnings should running aclocal / automake /
      autoconf, there were various such warnings from automake in the
      libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
      directories that I did not fix, preferring to leave those to the
      relevant subsystem maintainers.  Specifically, most of those warnings
      were of the following form (example from libgfortran):
      
      Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
      Makefile.am:48: but option 'subdir-objects' is disabled
      automake: warning: possible forward-incompatibility.
      automake: At least a source file is in a subdirectory, but the 'subdir-objects'
      automake: automake option hasn't been enabled.  For now, the corresponding output
      automake: object file(s) will be placed in the top-level directory.  However,
      automake: this behaviour will change in future Automake versions: they
      will
      automake: unconditionally cause object files to be placed in the same subdirectory
      automake: of the corresponding sources.
      automake: You are advised to start using 'subdir-objects' option throughout your
      automake: project, to avoid future incompatibilities.
      
      I think it's best for the relevant maintainers to add subdir-objects
      and do any other associated Makefile.am changes needed.  In some cases
      the paths in the warnings involved ../; I don't know if that adds any
      extra complications to the use of subdir-objects.
      
      I've tested this with native, cross and Canadian cross builds.  The
      risk of any OS-specific issues should I hope be rather lower than if a
      libtool upgrade were included (we *should* do such an upgrade at some
      point, but it's more complicated - it involves identifying all our
      local libtool changes to see if any aren't included in the upstream
      version we update to, and reverting an upstream libtool patch that's
      inappropriate for use in GCC); I think it would be better to get this
      update into GCC so that people can test in different configurations
      and we can fix any issues found, rather than to try to get more and
      more testing done before it goes in.
      
      top level:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* multilib.am: New file.  From automake.
      
      	Merge from binutils-gdb:
      	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
      
      	* libtool.m4: Use AC_LANG_SOURCE.
      	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
      	* ar-lib: New file.
      	* test-driver: New file.
      	* configure: Re-generate.
      
      config:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* math.m4, tls.m4: Use AC_LANG_SOURCE.
      
      	Merge from binutils-gdb:
      	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
      
      	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.
      
      fixincludes:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.
      	* aclocal.m4, configure: Regenerate.
      
      gcc:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use single
      	line for second argument of AC_DEFINE_UNQUOTED.
      	* doc/install.texi (Tools/packages necessary for modifying GCC):
      	Update to autoconf 2.69 and automake 1.15.1.
      	* aclocal.m4, config.in, configure: Regenerate.
      
      gnattools:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.
      	* configure: Regenerate.
      
      gotools:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* config/go.m4: Remove file.
      	* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
      	* configure.ac:  Remove AC_PREREQ.  Do not include config/go.m4.
      	* Makefile.in, aclocal.m4, configure: Regenerate.
      
      intl:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	Merge from binutils-gdb:
      	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
      
      	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
      	* configure: Re-generate.
      	* config.h.in: Re-generate.
      	* aclocal.m4: Re-generate.
      
      libada:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.
      	* configure: Regenerate.
      
      libatomic:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* acinclude.m4: Use AC_LANG_SOURCE.
      	* configure.ac: Remove AC_PREREQ.
      	* testsuite/Makefile.am (RUNTEST): Remove quotes.
      	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
      	Regenerate.
      
      libbacktrace:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
      	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
      
      libcc1:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, configure: Regenerate.
      
      libcpp:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
      	* aclocal.m4, config.in, configure: Regenerate.
      
      libdecnumber:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	Merge from binutils-gdb:
      	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
      
      	* configure.ac: Remove AC_PREREQ.
      	* configure: Re-generate.
      	* aclocal.m4.
      
      libffi:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	(AUTOMAKE_OPTIONS): Add info-in-builddir.
      	(CLEANFILES): Remove doc/libffi.info.
      	* configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
      	include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
      	Regenerate.
      
      libgcc:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
      	* configure: Regenerate.
      
      libgfortran:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
      
      libgo [logically part of this change but omitted from the commit]:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* config/go.m4: Remove file.
      	* config/libtool.m4: Use AC_LANG_SOURCE.
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use
      	-Wno-override in AM_INIT_AUTOMAKE call.
      	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
      	Regenerate.
      
      libgomp:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am
      	(AUTOMAKE_OPTIONS): Add info-in-builddir.
      	(CLEANFILES): Remove libgomp.info.
      	* configure.ac: Remove AC_PREREQ.
      	* testsuite/Makefile.am (RUNTEST): Remove quotes.
      	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
      	Regenerate.
      
      libhsail-rt:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, configure: Regenerate.
      
      libiberty:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	Merge from binutils-gdb:
      	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
      
      	* configure.ac: Remove AC_PREREQ.
      	* configure: Re-generate.
      	* config.in: Re-generate.
      
      libitm:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	(AUTOMAKE_OPTIONS): Add info-in-builddir.
      	(CLEANFILES): Remove libitm.info.
      	* configure.ac: Remove AC_PREREQ.
      	* testsuite/Makefile.am (RUNTEST): Remove quotes.
      	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
      	Regenerate.
      
      libobjc:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.
      	* aclocal.m4, config.h.in, configure: Regenerate.
      
      liboffloadmic:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.
      	* plugin/Makefile.am: Include multilib.am.
      	* plugin/configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
      	plugin/aclocal.m4, plugin/configure: Regenerate.
      
      libphobos:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.  Use -Wno-override in
      	AM_INIT_AUTOMAKE call.
      	* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
      	* m4/druntime/os.m4: Use AC_LANG_SOURCE.
      	* testsuite/Makefile.am (RUNTEST): Remove quotes.
      	* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
      	src/Makefile.in, testsuite/Makefile.in: Regenerate.
      
      libquadmath:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	(AUTOMAKE_OPTIONS): Remove 1.8.  Add info-in-builddir.
      	(all-local): Define outside conditional code.
      	(CLEANFILES): Remove libquadmath.info.
      	* configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
      
      libsanitizer:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
      	* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
      	interception/Makefile.in, libbacktrace/Makefile.in,
      	lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
      	ubsan/Makefile.in: Regenerate.
      
      libssp:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	(AUTOMAKE_OPTIONS): Remove 1.9.5.
      	* configure.ac: Remove AC_PREREQ.  Quote argument to
      	AC_RUN_IFELSE.
      	* Makefile.in, aclocal.m4, configure: Regenerate.
      
      libstdc++-v3:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.
      	* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
      	include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
      	python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
      	src/c++17/Makefile.in, src/c++98/Makefile.in,
      	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.
      
      libvtv:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      	* configure.ac: Remove AC_PREREQ.
      	* testsuite/Makefile.am (RUNTEST): Remove quotes.
      	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
      	Regenerate.
      
      lto-plugin:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
      	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.
      
      zlib:
      2018-10-31  Joseph Myers  <joseph@codesourcery.com>
      
      	PR bootstrap/82856
      	* Makefile.am: Include multilib.am.
      
      	Merge from binutils-gdb:
      	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>
      
      	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
      	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
      	* Makefile.in: Re-generate.
      	* aclocal.m4: Re-generate.
      	* configure: Re-generate.
      
      From-SVN: r265695
      Joseph Myers committed
    • [6/6] Preprocessor forced macro location · f3f6029d
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02044.html
      	libcpp/
      	* internal.h (struct cpp_reader): Rename forced_token_location_p
      	to forced_token_location and drop its pointerness.
      	* include/cpplib.h (cpp_force_token_locations): Take location, not
      	pointer to one.
      	* init.c (cpp_create_reader): Adjust.
      	* lex.c (cpp_read_main_file): 
      
      	gcc/c-family/
      	* c-opts.c (c_finish_options): Adjust cpp_force_token_locations call.
      
      	gcc/fortran/
      	* cpp.c (gfc_cpp_init): Adjust cpp_force_token_locations call.
      
      From-SVN: r265692
      Nathan Sidwell committed
    • [5/6] Preprocessor include · 705b0c05
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02041.html
      	* directives.c (do_include_common): Commonize cleanup path.
      	(_cpp_pop_buffer): Fix leak.
      
      From-SVN: r265690
      Nathan Sidwell committed
    • [4/7] Preprocessor location-kind predicates · 87bacc2b
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02040.html
      	* include/line-map.h (IS_ORDINARY_LOC, IS_MACRO_LOC): New
      	predicates.
      	(IS_ADHOC_LOC): Move earlier.
      	(MAP_ORDINARY_P): Use IS_ORDINARY_LOC.
      	* line-map.c (linemap_location_from_macro_expansion_p): Use
      	IS_MACRO_LOC.
      
      From-SVN: r265689
      Nathan Sidwell committed
    • [3/7] Preprocessor macro loc · c9fb347e
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02039.html
      	* include/cpplib.h (cpp_macro_definition_location): Make inline.
      	* macro.c (warn_of_redefinition): Fix comments, examine macro
      	type, use C++ for.
      	(cpp_macro_definition_location): Don't define here.
      
      From-SVN: r265688
      Nathan Sidwell committed
    • [2/7] Preprocessor node access · 43af5ef1
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02038.html
      	* include/cpplib.h (HT_NODE): Don't cast NODE.
      	(NODE_LEN, NODE_NAME): Use HT_NODE.
      
      From-SVN: r265687
      Nathan Sidwell committed
    • [1/7] Preprocessor cleanup · ff65e980
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg02037.html
      	* directives.c (DIRECTIVE_TABLE): Drop historical frequency
      	comments.
      	* files.c (_cpp_stack_file): Fix indentation.
      
      From-SVN: r265685
      Nathan Sidwell committed
  7. 17 Oct, 2018 1 commit
    • Add -std=c2x, -std=gnu2x, -Wc11-c2x-compat, C2X _Static_assert support. · 9f936c86
      Now new features are starting to be added to a C2X draft (in the C2x
      branch of the C standard git repository, no public WG14 document yet),
      it's time to add -std=c2x and associated options to GCC for use in
      enabling C2X features.
      
      This patch adds the expected set of options: -std=c2x, -std=gnu2x,
      -Wc11-c2x-compat.  A first C2X feature is added (the only one so far
      in the repository that's obviously relevant to GCC): support (as in
      C++) for the string constant to be omitted in _Static_assert.  This
      feature is duly also supported as an extension in earlier standard
      modes (diagnosed with -pedantic, unless -Wno-c11-c2x-compat is given,
      or with -Wc11-c2x-compat even in C2X mode).
      
      Bootstrapped with no regressions on x86_64-pc-linux-gnu.
      
      gcc/
      	* doc/cpp.texi (__STDC_VERSION__): Document C2X handling.
      	* doc/invoke.texi (-std=c2x, -std=gnu2x): Document new options.
      	* doc/standards.texi (C Language): Document C2X.
      	* dwarf2out.c (highest_c_language), config/rl78/rl78.c
      	(rl78_option_override): Handle "GNU C2X" language name.
      
      gcc/c/
      	* c-errors.c (pedwarn_c11): New function.
      	* c-parser.c (disable_extension_diagnostics): Save
      	warn_c11_c2x_compat and set it to 0.
      	(restore_extension_diagnostics): Restore warn_c11_c2x_compat.
      	(c_parser_static_assert_declaration_no_semi): Handle
      	_Static_assert without string constant.
      	* c-tree.h (pedwarn_c11): New prototype.
      
      gcc/c-family/
      	* c-common.c (flag_isoc2x): New variable.
      	* c-common.h (clk_c): Update comment to reference C2X.
      	(flag_isoc99, flag_isoc11): Update comments to reference future
      	standard versions in general.
      	(flag_isoc2x): Declare.
      	* c-opts.c (set_std_c2x): New function.
      	(c_common_handle_option): Handle -std=c2x and -std=gnu2x.
      	(set_std_c89, set_std_c99, set_std_c11, set_std_c17): Set
      	flag_isoc2x to 0.
      	* c.opt (Wc11-c2x-compat, std=c2x, std=gnu2x): New options.
      
      gcc/testsuite/
      	* gcc.dg/c11-static-assert-7.c, gcc.dg/c11-static-assert-8.c,
      	gcc.dg/c11-static-assert-9.c, gcc.dg/c2x-static-assert-1.c,
      	gcc.dg/c2x-static-assert-2.c, gcc.dg/c99-static-assert-2.c,
      	gcc.dg/gnu2x-static-assert-1.c: New tests.
      	* gcc.dg/missing-symbol-3.c: Update expected fix-it text.
      
      libcpp/
      	* include/cpplib.h (enum c_lang): Add CLK_GNUC2X and CLK_STDC2X.
      	* init.c (lang_defaults): Add GNUC2X and STDC2X entries.
      	(cpp_init_builtins): Define __STDC_VERSION__ to 202000L for C2X.
      
      From-SVN: r265251
      Joseph Myers committed
  8. 11 Oct, 2018 2 commits
    • libcpp: show macro definition when used with wrong argument count · 954ad112
      Consider:
      
      demo.c: In function 'test':
      demo.c:5:40: error: macro "LOG_2" requires 3 arguments, but only 2 given
      5 |   LOG_2 ("loading file: %s\n", filename);
        |                                        ^
      
      This patch adds a note showing the definition of the macro in
      question, giving:
      
      demo.c: In function 'test':
      demo.c:5:40: error: macro "LOG_2" requires 3 arguments, but only 2 given
      5 |   LOG_2 ("loading file: %s\n", filename);
        |                                        ^
      In file included from demo.c:1:
      logging.h:1: note: macro "LOG_2" defined here
      1 | #define LOG_2(FMT, ARG0, ARG1) do { fprintf (stderr, (FMT), (ARG0), (ARG1)); }
        | 
      
      gcc/testsuite/ChangeLog:
      	* g++.dg/diagnostic/macro-arg-count.C: Move to...
      	* c-c++-common/cpp/macro-arg-count-1.c: ...here, generalizing
      	output for C vs C++.  Expect notes showing the definitions of the
      	macros.
      	* c-c++-common/cpp/macro-arg-count-2.c: New test, adapted from the
      	above.
      
      libcpp/ChangeLog:
      	* macro.c (_cpp_arguments_ok): If the argument count is wrong, add
      	a note showing the definition of the macro.
      
      From-SVN: r265040
      David Malcolm committed
    • [PATCH] A couple of line map fixes · c1b48b29
      https://gcc.gnu.org/ml/gcc-patches/2018-10/msg00623.html
      	* include/line-map.h (LINEMAPS_MACRO_LOWEST_LOCATION): Fix
      	off-by-one error.
      	* line-map.c (linemap_enter_macro): Use RAII.  Clear all of the
      	macro_locations.
      
      From-SVN: r265037
      Nathan Sidwell committed
  9. 09 Oct, 2018 1 commit
    • Cleanup of libcpp diagnostic callbacks · c24300ba
      This patch renames the "error" callback within libcpp
      to "diagnostic", and uses the pair of enums in cpplib.h, rather
      than passing two different kinds of "int" around.
      
      gcc/c-family/ChangeLog:
      	* c-common.c (c_option_controlling_cpp_error): Rename to...
      	(c_option_controlling_cpp_diagnostic): ...this, and convert
      	"reason" from int to enum.
      	(c_cpp_error): Rename to...
      	(c_cpp_diagnostic): ...this, converting level and reason to enums.
      	* c-common.h (c_cpp_error): Rename to...
      	(c_cpp_diagnostic): ...this, converting level and reason to enums.
      	* c-opts.c (c_common_init_options): Update for renaming.
      
      gcc/fortran/ChangeLog:
      	* cpp.c (gfc_cpp_init_0): Update for renamings.
      	(cb_cpp_error): Rename to...
      	(cb_cpp_diagnostic): ...this, converting level and reason to
      	enums.
      
      gcc/ChangeLog:
      	* genmatch.c (error_cb): Rename to...
      	(diagnostic_cb): ...this, converting int params to enums.
      	(fatal_at): Update for renaming.
      	(warning_at): Likewise.
      	(main): Likewise.
      	* input.c (selftest::ebcdic_execution_charset::apply):
      	Update for renaming of...
      	(selftest::ebcdic_execution_charset::on_error): ...this, renaming
      	to...
      	(selftest::ebcdic_execution_charset::on_diagnostic): ...this,
      	converting level and reason to enums.
      	(class selftest::lexer_error_sink): Rename to...
      	(class selftest::lexer_test_options): ...this, renaming field
      	"m_errors" to "m_diagnostics".
      	(selftest::lexer_test_options::apply): Update for renaming of...
      	(selftest::lexer_test_options::on_error): ...this, renaming to...
      	(selftest::lexer_test_options::on_diagnostic): ...this
      	converting level and reason to enums.
      	(selftest::test_lexer_string_locations_raw_string_unterminated):
      	Update for renamings.
      	* opth-gen.awk (struct cpp_reason_option_codes_t): Use enum for
      	"reason".
      
      libcpp/ChangeLog:
      	* charset.c (noop_error_cb): Rename to...
      	(noop_diagnostic_cb): ...this, converting params to enums.
      	(cpp_interpret_string_ranges): Update for renaming and enums.
      	* directives.c (check_eol_1): Convert reason to enum.
      	(do_diagnostic): Convert code and reason to enum.
      	(do_error): Use CPP_W_NONE rather than 0.
      	(do_pragma_dependency): Likewise.
      	* errors.c (cpp_diagnostic_at): Convert level and reason to enums.
      	Update for renaming.
      	(cpp_diagnostic): Convert level and reason to enums.
      	(cpp_error): Convert level to enum.
      	(cpp_warning): Convert reason to enums.
      	(cpp_pedwarning): Likewise.
      	(cpp_warning_syshdr): Likewise.
      	(cpp_diagnostic_with_line): Convert level and reason to enums.
      	Update for renaming.
      	(cpp_error_with_line): Convert level to enum.
      	(cpp_warning_with_line): Convert reason to enums.
      	(cpp_pedwarning_with_line): Likewise.
      	(cpp_warning_with_line_syshdr): Likewise.
      	(cpp_error_at): Convert level to enum.
      	(cpp_errno): Likewise.
      	(cpp_errno_filename): Likewise.
      	* include/cpplib.h (enum cpp_diagnostic_level): Name this enum,
      	and move to before struct cpp_callbacks.
      	(enum cpp_warning_reason): Likewise.
      	(cpp_callbacks::diagnostic): Convert params from int to enums.
      	(cpp_error): Convert int param to enum cpp_diagnostic_level.
      	(cpp_warning): Convert int param to enum cpp_warning_reason.
      	(cpp_pedwarning): Likewise.
      	(cpp_warning_syshdr): Likewise.
      	(cpp_errno): Convert int param to enum cpp_diagnostic_level.
      	(cpp_errno_filename): Likewise.
      	(cpp_error_with_line): Likewise.
      	(cpp_warning_with_line): Convert int param to enum
      	cpp_warning_reason.
      	(cpp_pedwarning_with_line): Likewise.
      	(cpp_warning_with_line_syshdr): Likewise.
      	(cpp_error_at): Convert int param to enum cpp_diagnostic_level.
      	* macro.c (create_iso_definition): Convert int to enum.
      	(_cpp_create_definition): Likewise.
      
      From-SVN: r264999
      David Malcolm committed
  10. 17 Sep, 2018 1 commit
    • Add range_idx param to range_label::get_text · 9c4a4b3c
      This patch updates the pure virtual function range_label::get_text
      (and its implementations) so that the index of the range is passed
      in, allowing for one label instance to be shared by multiple ranges.
      
      gcc/c-family/ChangeLog:
      	* c-format.c (range_label_for_format_type_mismatch::get_text):
      	Update for new param.
      
      gcc/c/ChangeLog:
      	* c-objc-common.c (range_label_for_type_mismatch::get_text):
      	Update for new param.
      	* c-typeck.c (maybe_range_label_for_tree_type_mismatch::get_text):
      	Likewise.
      
      gcc/cp/ChangeLog:
      	* error.c (range_label_for_type_mismatch::get_text): Update for
      	new param.
      
      gcc/ChangeLog:
      	* diagnostic-show-locus.c (class layout_range): Add field
      	"m_original_idx".
      	(layout_range::layout_range): Add "original_idx" param and use it
      	to initialize new field.
      	(make_range): Use 0 for original_idx.
      	(layout::layout): Pass in index to calls to
      	maybe_add_location_range.
      	(layout::maybe_add_location_range): Add param "original_idx" and
      	pass it on to layout_range.
      	(layout::print_any_labels): Pass on range->m_original_idx to
      	get_text call.
      	(gcc_rich_location::add_location_if_nearby): Use 0 for
      	original_idx.
      	* gcc-rich-location.h (text_range_label::get_text): Update for new
      	param.
      	(range_label_for_type_mismatch::get_text): Likewise.
      
      libcpp/ChangeLog:
      	* include/line-map.h (range_label::get_text): Add param
      	"range_idx".
      
      From-SVN: r264376
      David Malcolm committed
  11. 30 Aug, 2018 1 commit
  12. 27 Aug, 2018 2 commits
    • Replace 8 spaces with a tabular in ChangeLog files. · 92a285c1
      From-SVN: r263886
      Martin Liska committed
    • Less verbose fix-it hints for missing header files (PR 87091) · 85204e23
      This patch tweaks maybe_add_include_fixit so that if we're emitting a note
      about adding the header file, the note's primary location will be replaced
      by that of the fix-it hint, to avoid repeating a location we've already
      emitted (or one close to it).
      
      For example, this simplifies:
      
        ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
        87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
           |                           ^~~~~~
        ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:22: note: msg 2
         73 | # include <debug/vector>
        +++ |+#include <vector>
         74 | #endif
        ....
         87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
            |                      ^~~
      
      to:
      
        ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:87:27: error: msg 1
        87 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
           |                           ^~~~~~
        ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
         73 | # include <debug/vector>
        +++ |+#include <vector>
         74 | #endif
      
      eliminating the repetition of line 87 in the note.
      
      Doing so requires converting show_caret_p to a tri-state, to avoid
      meaninglessly printing a caret for the first column in the next line
      (and colorizing it):
      
        ../x86_64-pc-linux-gnu/libstdc++-v3/include/vector:74:1: note: msg 2
         73 | # include <debug/vector>
        +++ |+#include <vector>
         74 | #endif
            | ^
      
      gcc/c-family/ChangeLog:
      	PR 87091
      	* c-common.c (c_cpp_error): Update for conversion of show_caret_p
      	to a tri-state.
      	(maybe_suggest_missing_token_insertion): Likewise.
      	(maybe_add_include_fixit): Add param "override_location".  If set,
      	and source-printing is enabled, then override the rich_location's
      	primary location with that of the insertion point for the fix-it
      	hint, marking it with SHOW_LINES_WITHOUT_RANGE.
      	* c-common.h (extern void maybe_add_include_fixit): Add bool
      	param.
      	* c-format.c (selftest::test_type_mismatch_range_labels): Update
      	for conversion of show_caret_p to a tri-state.
      	* c-warn.c (warn_for_restrict): Likewise.
      	* known-headers.cc
      	(suggest_missing_header::~suggest_missing_header): Update call to
      	maybe_add_include_fixit to suggest overriding the location, as it
      	is for a note.
      
      gcc/c/ChangeLog:
      	PR 87091
      	* c-decl.c (implicitly_declare): Update call to
      	maybe_add_include_fixit to suggest overriding the location, as it
      	is for a note.
      	* c-objc-common.c (c_tree_printer): Update for conversion of
      	show_caret_p to a tri-state.
      
      gcc/cp/ChangeLog:
      	PR 87091
      	* decl.c (grokdeclarator): Update for conversion of show_caret_p
      	to a tri-state.
      	* error.c (cp_printer): Likewise.
      	* name-lookup.c (maybe_suggest_missing_std_header): Update call to
      	maybe_add_include_fixit to suggest overriding the location, as it
      	is for a note.
      	* parser.c (cp_parser_string_literal): Update for conversion of
      	show_caret_p to a tri-state.
      	(cp_parser_elaborated_type_specifier): Likewise.
      	(set_and_check_decl_spec_loc): Likewise.
      	* pt.c (listify): Update call to maybe_add_include_fixit to not
      	override the location, as it is for an error.
      	* rtti.c (typeid_ok_p): Likewise.
      
      gcc/ChangeLog:
      	PR 87091
      	* diagnostic-show-locus.c (class layout_range): Update for
      	conversion of show_caret_p to a tri-state.
      	(layout_range::layout_range): Likewise.
      	(make_range): Likewise.
      	(layout::maybe_add_location_range): Likewise.
      	(layout::should_print_annotation_line_p): Don't show annotation
      	lines for ranges that are SHOW_LINES_WITHOUT_RANGE.
      	(layout::get_state_at_point): Update for conversion of
      	show_caret_p to a tri-state.  Bail out early for
      	SHOW_LINES_WITHOUT_RANGE, so that such ranges don't affect
      	underlining or source colorization.
      	(gcc_rich_location::add_location_if_nearby): Update for conversion
      	of show_caret_p to a tri-state.
      	(selftest::test_one_liner_multiple_carets_and_ranges): Likewise.
      	(selftest::test_one_liner_fixit_replace_equal_secondary_range):
      	Likewise.
      	(selftest::test_one_liner_labels): Likewise.
      	* gcc-rich-location.c (gcc_rich_location::add_expr): Update for
      	conversion of show_caret_p to a tri-state.
      	* pretty-print.c (text_info::set_location): Likewise.
      	* pretty-print.h (text_info::set_location): Likewise.
      	* substring-locations.c (format_warning_n_va): Likewise.
      	* tree-diagnostic.c (default_tree_printer): Likewise.
      	* tree-pretty-print.c (newline_and_indent): Likewise.
      
      gcc/fortran/ChangeLog:
      	PR 87091
      	* error.c (gfc_format_decoder): Update for conversion of
      	show_caret_p to a tri-state.
      
      gcc/testsuite/ChangeLog:
      	PR 87091
      	* gcc.dg/empty.h: New file.
      	* gcc.dg/fixits-pr84852-1.c: Update for move of fix-it hint to
      	top of file and removal of redundant second printing of warning
      	location.
      	* gcc.dg/fixits-pr84852-2.c: Likewise.
      	* gcc.dg/missing-header-fixit-3.c: Likewise.
      	* gcc.dg/missing-header-fixit-4.c: New test.
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c: Update for
      	conversion of show_caret_p to a tri-state.
      
      libcpp/ChangeLog:
      	PR 87091
      	* include/line-map.h (enum range_display_kind): New enum.
      	(struct location_range): Replace field "m_show_caret_p" with
      	"m_range_display_kind", converting from bool to the new enum.
      	(class rich_location): Add example of line insertion fix-it hint.
      	(rich_location::add_range): Convert param "show_caret_p" from bool
      	to enum range_display_kind and rename to "range_display_kind",
      	giving it a default of SHOW_RANGE_WITHOUT_CARET.
      	(rich_location::set_range): Likewise, albeit without a default.
      	* line-map.c (rich_location::rich_location): Update for conversion
      	of show_caret_p to tri-state enum.
      	(rich_location::add_range): Likewise.
      	(rich_location::set_range): Likewise.
      
      From-SVN: r263885
      David Malcolm committed
  13. 24 Aug, 2018 1 commit
    • Set start_location to 0 if we ran out of line map space · cf806c7d
      With profiledbootstrap and --with-build-config=bootstrap-lto, linemap_add
      may create a macro map when we run out of line map space.  This patch
      changes start_location to UNKNOWN_LOCATION (0) in this case.
      
      Tested with profiledbootstrap and --with-build-config=bootstrap-lto on
      Linux/x86-64.
      
      	PR bootstrap/86872
      	* line-map.c (pure_location_p): Return true if linemap_lookup
      	returns NULL.
      	(linemap_add): Set start_location to 0 if we run out of line map
      	space.
      
      From-SVN: r263845
      H.J. Lu committed
  14. 20 Aug, 2018 5 commits
    • [CPP PATCH] node field bits · a5a35247
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01171.html
      	* include/cpplib.h: Fixup some whitespace.
      	(cpp_hashnode): Reduce type to 2 bit & flags to 8.
      
      From-SVN: r263669
      Nathan Sidwell committed
    • [CPP PATCH] node type · a570d97f
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01164.html
      	* include/cpplib.h (NODE_BUILTIN, NODE_MACRO_ARG): Delete.
      	Renumber others.
      	(enum node_type): Replace NT_MACRO with NT_USER_MACRO,
      	NT_BUILTIN_MACRO, NT_MACRO_ARG.  Delete NT_ASSERTION.
      	(NTV_MACRO, NTV_ANSWER, NTV_BUILTIN, NTV_ARGUMENT, NTV_NONE):
      	Delete.
      	(CPP_HASHNODE_VALUE_IDX): Delete.
      	(union _cpp_hashnode_value): GTY tag from enum node_type directly.
      	(struct cpp_hashnode): Adjust GTY desc for value field.
      	(cpp_user_macro_p, cpp_builtin_macro_p, cpp_macro_p): Adjust.
      	* directives.c (undefine_macros): Clear value.anwers, adjust flag
      	clearing.
      	(_cpp_test_assertion): No need to check NT_ASSERTION.
      	(do_assert, do_unassert): Likewise.
      	* init.c (cpp_init_special_builtins): Set type not flags.
      	* macro.c (struct macro_arg_saved_data): Add type field.
      	(cpp_get_token_1): Check type not NT_VOID.
      	(_cpp_free_definition): Adjust flag clearing.  Nullify
      	value.answers.
      	(_cpp_save_parameter, _cpp_unsave_parameters): Save and restore
      	type.
      	(lex_expansion_token): Check type not flags.
      	(_cpp_create_definition): Set type to NT_USER_MACRO.
      	(_cpp_notify_macro_use): Adjust type checking.
      	* pch.c (write_macdef, count_defs, write_defs, cpp_valid_state)
      	(save_macros): Adjust node type/flag handling.
      	* traditional.c (_cpp_scan_out_logical_line): Check type not flags.
      
      From-SVN: r263667
      Nathan Sidwell committed
    • [CPP PATCH] Fix warning & other cleanups. · 7692e253
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01162.html
      	* directives.c (do_undef): Use cpp_macro_p & cpp_builtin_macro_p.
      	* include/cpplib.h (enum cpp_macro_kind): Remove trailing comma.
      	(cpp_fun_like_macro_p): Make inline, define.
      	* macro.c (cpp_define_lazily): Use UCHAR_MAX.
      	(cpp_fun_like_macro_p): Delete.
      
      From-SVN: r263666
      Nathan Sidwell committed
    • [PATCH] Kill cpp-id-data.h · abcd1775
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01149.html
      	libcpp/
      	* Makefile.in (TAGS_SOURCES): Remove cpp-id-data.h.
      	* include/cpp-id-data.h: Delete.
      	* internal.h: Include cpplib.h not cpp-id-data.h.
      	gcc/
      	* Makefile.in (CPP_ID_DATA_H): Delete.
      	(CPP_INTERNAL_H): Don't add it.
      	(GTFILES): Replace CPP_ID_DATA_H with CPPLIB_H.
      	* gengtype.c (open_base_files): Replace cpp-id-data.h with cpplib.h
      
      From-SVN: r263663
      Nathan Sidwell committed
    • [PATCH] #assert becomes macro-like · 3fb558b1
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01140.html
      	libcpp/
      	* include/cpp-id-data.h (struct answer): Delete.
      	* include/cpplib.h (struct answer): Don't forward-declare.
      	(enum cpp_macro_kind): Add cmk_assert.
      	(struct cpp_macro): Union parms and next assert chain.
      	(union _cpp_hashnode_value): 'answer' field is cpp_macro.
      	* directives.c (parse_answer): Convert to use cpp_macro. Return
      	true on success. 
      	(parse_assertion, find_answer, _cpp_test_assertion, cpp_do_assert)
      	(cpp_do_unassert): Convert to use cpp_macro.
      	* macro.c (warn_of_redefinition, _cpp_new_macro)
      	(check_trad_stringification, cpp_macro_definition): Adjust macro
      	parm access.
      	* traditional.c (_cpp_replacement_text_len)
      	(_cpp_copy_replacement_text, _cpp_create_trad_definition): Likewise.
      	gcc/c-family/
      	* c-ada-spec.c (macro_length, dump_ada_macros): Adjust macro parm
      	access.
      
      From-SVN: r263658
      Nathan Sidwell committed
  15. 17 Aug, 2018 3 commits
    • [PATCH] Adjust lazy macro definition · 800c0e98
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01072.html
      	libcpp/
      	* include/cpplib.h (struct cpp_callbacks): Replace
      	user_builtin_macro with user_lazy_macro.
      	(struct cpp_macro): add lazy field.
      	(enum cpp_builtin_type): Remove BT_FIRST_USER, BT_LAST_USER.
      	(cpp_define_lazily): Declare.
      	* macro.c (enter_macro_context) Use _cpp_maybe_notify_macro_use.
      	(warn_of_redefinition): Use cpp_builtin_macro_p, directly call
      	user_lazy_macro hook.
      	(_cpp_new_macro): Clear lazy field.
      	(cpp_define_lazily): Define.
      	(_cpp_notify_macro_use): Adjust lazy definition code.
      	(cpp_macro_definition): No need to do lazy definition here.
      	* pch.c (write_macdef, save_macros): Likewise.
      	gcc/c-family/
      	* c-cppbuiltin.c (struct lazy_hex_fp_value_struct): Remove macro
      	field.
      	(laxy_hex_fp_value_count): Make unsigned.
      	(lazy_hex_fp_value): Provided with macro & lazy number.  Directly
      	manipulate the macro.
      	(builtin_defin_with_hex_fp_value): Adjust callback name, use
      	cpp_define_lazily.
      
      From-SVN: r263640
      Nathan Sidwell committed
    • [PATCH] Macro body is trailing array · 10f04917
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01037.html
      	* include/cpplib.h (enum cpp_macro_kind): New.
      	(struct cpp_macro): Make body trailing array.  Add kind field,
      	delete traditional flag.
      	* internal.h (_cpp_new_macro): Declare.
      	(_cpp_reserve_room): New inline.
      	(_cpp_commit_buf): Declare.
      	(_cpp_create_trad_definition): Return new macro.
      	* lex.c (_cpp_commit_buff): New.
      	* macro.c (macro_real_token_count): Count backwards.
      	(replace_args): Pointer equality not orderedness.
      	(_cpp_save_parameter): Use _cpp_reserve_room.
      	(alloc_expansion_token): Delete.
      	(lex_expansion_token): Return macro pointer.  Use _cpp_reserve_room.
      	(create_iso_definition): Allocate macro itself.  Adjust for
      	different allocation ordering.
      	(_cpp_new_macro): New.
      	(_cpp_create_definition): Adjust for API changes.
      	* traditional.c (push_replacement_text): Don't set traditional
      	flag.
      	(save_replacement_text): Likewise.
      	(_cpp_create_trad_definition): Allocate macro itself, Adjust for
      	different allocation ordering.
      
      From-SVN: r263622
      Nathan Sidwell committed
    • [PATCH] Move cpp_macro to cpplib.h · c5d725c0
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg01016.html
      	libcpp/
      	* cpp-id-data.h (uchar, UC): Move to internal.h
      	(struct cpp_macro): Move to cpplib.h.
      	* internal.h (uchar, UC): From cpp-id-data.h.
      	* include/cpplib.h (struct cpp_macro): From cpp-id-data.h.
      	gcc/c-family/
      	* c-ada-spec.c: Don't #include "cpp-id-data.h"
      	* c-cppbuiltin.c: Likewise.
      	gcc/
      	* cppbuiltin.c: Include "cpplib.h", not "cpp-id-data.h".
      
      From-SVN: r263618
      Nathan Sidwell committed
  16. 16 Aug, 2018 2 commits
    • [PATCH] Macro definition parameter parsing · 729a01f7
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00977.html
      	libcpp/
      	* internal.h (_cpp_save_parameter): Take parmno, not macro.
      	(_cpp_unsave_parameters): Declare.
      	* macro.c (_cpp_save_parameter): Take parm number, not macro.
      	Return true on success.
      	(_cpp_unsave_parameters): New.
      	(parse_params): Take parm_no and variadic pointers, not macro.
      	Reimplement parsing logic.
      	(create_iso_definition): Adjust parse_params changes.  Call
      	_cpp_unsave_parameters here.
      	(_cpp_create_definition): Don't unsave params here.
      	* traditional.c (scan_parameters): Take n_param pointer, adjust.
      	(_cpp_create_trad_definition): Ajust scan_parameters change.  Call
      	_cpp_unsave_parameters.
      	gcc/testsuite/
      	* gcc.dg/cpp/macsyntx.c: Adjust expected errors.
      	* gcc.dg/cpp/macsyntx2.c: likewise.
      
      From-SVN: r263600
      Nathan Sidwell committed
    • [PATCH] CPP Macro predicates · 3f6677f4
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00897.html
      	libcpp/
      	* include/cpplib.h (cpp_user_macro_p, cpp_builtin_macro_p)
      	(cpp_macro_p): New inlines.
      	* directives.c (do_pragma_poison): Use cpp_macro_p.
      	(do_ifdef, do_ifndef): Likewise.  Use _cpp_maybe_notify_macro_use.
      	(cpp_pop_definition): Use cpp_macro_p.  Move _cpp_free_definition
      	earlier.  Don't zap node directly.
      	* expr.c (parse_defined): Use _cpp_maybe_notify_macro_use &
      	cpp_macro_p.
      	* files.c (should_stack_file): Use cpp_macro_p.
      	* identifiers.c (cpp_defined): Likewise.
      	* internal.h (_cpp_mark_macro): Use cpp_user_macro_p.
      	(_cpp_notify_macro_use): Declare.
      	(_cpp_maybe_notify_macro_use): New inline.
      	* lex.c (is_macro): Use cpp_macro_p.
      	* macro.c (_cpp_warn_if_unused_macro): Use cpp_user_macro_p.
      	(enter_macro_context): Likewise.
      	(_cpp_create_definition): Use cpp_builtin_macro_p,
      	cpp_user_macro_p.  Move _cpp_free_definition earlier.
      	(_cpp_notify_macro_use): New, broken out of multiple call sites.
      	* traditional.c (fun_like_macro_p): Use cpp_builtin_macro_p.
      	(maybe_start_funlike, _cpp_scan_out_logical_line)
      	(push_replacement_text): Likewise.
      	gcc/c-family/
      	* c-ada-spec.c (count_ada_macro): Use cpp_user_macro_p.
      	(store_ada_macro): Likewise.
      	* c-ppoutput.c (cb_used_define, dump_macro): Likewise.
      	* c-spellcheck.cc (should-suggest_as_macro_p): Likewise,
      	gcc/
      	* config/rs6000/rs6000-c.c (rs6000_macro_to_expend): Use cpp_macro_p.
      	* config/powerpcspc/powerpcspe-c.c (rs6000_macro_to_expend): Likewise.
      	gcc/cp/
      	* name-lookup.c (lookup_name_fuzzy): Likewise.
      	gcc/fortran/
      	* cpp.c (dump_macro): Use cpp_user_macro_p.
      
      From-SVN: r263587
      Nathan Sidwell committed
  17. 15 Aug, 2018 1 commit
    • diagnostics: add labeling of source ranges · 96e6ae57
      This patch adds the ability to label source ranges within a rich_location,
      to be printed by diagnostic_show_locus.
      
      For example:
      
      pr69554-1.c:11:18: error: invalid operands to binary + (have 'const char *' and 'const char *')
      11 |   return (p + 1) + (q + 1);
         |          ~~~~~~~ ^ ~~~~~~~
         |             |         |
         |             |         const char *
         |             const char *
      
      The patch implements labels for various type mismatch errors in the C and
      C++ frontends, and in -Wformat.  I implemented it wherever accurate location
      information was guaranteed (there are other places that could benefit, but
      we need better location information in those places).
      
      The labels can be disabled via -fno-diagnostics-show-labels.
      
      Similarly:
      
      param-type-mismatch.C: In function 'int test_1(int, int, float)':
      param-type-mismatch.C:11:27: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
      11 |   return callee_1 (first, second, third);
         |                           ^~~~~~
         |                           |
         |                           int
      param-type-mismatch.C:7:43: note:   initializing argument 2 of 'int callee_1(int, const char*, float)'
      7 | extern int callee_1 (int one, const char *two, float three);
        |                               ~~~~~~~~~~~~^~~
      
      where the first "error" describing the bad argument gets a label
      describing the type inline (since it's non-obvious from "second").
      The "note" describing the type of the param of the callee *doesn't*
      get a label, since that information is explicit there in the
      source ("const char *two").
      
      The idea is that in any diagnostic where two aspects of the source aren't
      in sync it ought to be easier for the user if we directly show them the
      mismatching aspects inline (e.g. types).
      
      As well as type mismatch errors, perhaps labels could also be used for
      buffer overflow warnings, for describing the capacity of the destination
      buffer vs the size of what's being written:
      
        sprintf (buf, "filename: %s\n", file);
                 ^~~   ~~~~~~~~~~~^~~
                 |                |
                 capacity: 32     10 + strlen(file) + 2
      
      or somesuch.  Another idea might be for macro expansion warnings:
      
      warning: repeated side effects in macro expansion...
         x = MIN (p++, q++);
             ~~~~^~~~~~~~~~
      note: ...expanded here as
       #define MIN(X,Y) (X<Y?X:Y)
               ^~~ ~ ~   ~ ~ ~ ~
                   | |   | | | |
                   | |   | | | q++
                   | |   | | p++
                   | |   | q++
                   | q++ p++
                   p++
      
      The patch removes some logic from multiline.exp which special-cased
      lines ending with a '|' character (thus complicating testing of this
      patch).  I believe that this was a vestige from experiments I did to
      support strippng dg directives from the output; it was present in the
      earliest version of multiline.exp I posted:
        "[RFC, stage1] Richer source location information for gcc 6 (location ranges etc)"
          https://gcc.gnu.org/ml/gcc-patches/2015-03/msg00837.html
      and I believe was neved used.
      
      gcc/c-family/ChangeLog:
      	* c-format.c: Include "selftest-diagnostic.h" and
      	"gcc-rich-location.h".
      	(format_warning_at_char): Pass NULL for new label params of
      	format_warning_va.
      	(class indirection_suffix): New class.
      	(class range_label_for_format_type_mismatch): New class.
      	(format_type_warning): Move logic for generating "*" suffix to
      	class indirection_suffix.  Create "fmt_label" and "param_label"
      	to show their types, and pass them to the
      	format_warning_at_substring calls.
      	(selftest::test_type_mismatch_range_labels): New test.
      	(selftest::c_format_c_tests): Call it.
      
      gcc/c/ChangeLog:
      	* c-objc-common.c: Include "gcc-rich-location.h".
      	(c_tree_printer): Move implemenation of '%T' to...
      	(print_type): ...this new function.
      	(range_label_for_type_mismatch::get_text): New function.
      	* c-typeck.c (convert_for_assignment): Add type labels to the rhs
      	range for the various ic_argpass cases.
      	(class maybe_range_label_for_tree_type_mismatch): New class.
      	(build_binary_op): Use it when calling binary_op_error.
      
      gcc/cp/ChangeLog:
      	* call.c: Include "gcc-rich-location.h".
      	(convert_like_real): Add range label for "invalid conversion"
      	diagnostic.
      	(perform_implicit_conversion_flags): Add type label to the
      	"could not convert" error.
      	* error.c: Include "gcc-rich-location.h".
      	(range_label_for_type_mismatch::get_text): New function.
      	* typeck.c (convert_for_assignment): Add type label to
      	the "cannot convert" error if a location is available.
      
      gcc/ChangeLog:
      	* common.opt (fdiagnostics-show-labels): New option.
      	* diagnostic-show-locus.c (class layout_range): Add field
      	"m_label".
      	(class layout): Add field "m_show_labels_p".
      	(layout_range::layout_range): Add param "label" and use it to
      	initialize m_label.
      	(make_range): Pass in NULL for new "label" param of layout_range's
      	ctor.
      	(layout::layout): Initialize m_show_labels_p.
      	(layout::maybe_add_location_range): Pass in loc_range->m_label
      	when constructing layout_range instances.
      	(struct line_label): New struct.
      	(layout::print_any_labels): New member function.
      	(layout::print_line): Call it if label-printing is enabled.
      	(selftest::test_one_liner_labels): New test.
      	(selftest::test_diagnostic_show_locus_one_liner): Call it.
      	* diagnostic.c (diagnostic_initialize): Initialize
      	context->show_labels_p.
      	* diagnostic.h (struct diagnostic_context): Add field
      	"show_labels_p".
      	* doc/invoke.texi (Diagnostic Message Formatting Options): Add
      	-fno-diagnostics-show-labels.
      	* dwarf2out.c (gen_producer_string): Add
      	OPT_fdiagnostics_show_labels to the ignored options.
      	* gcc-rich-location.c (gcc_rich_location::add_expr): Add "label"
      	param.
      	(gcc_rich_location::maybe_add_expr): Likewise.
      	* gcc-rich-location.h (gcc_rich_location::gcc_rich_location): Add
      	label" param, defaulting to NULL.
      	(gcc_rich_location::add_expr): Add "label" param.
      	(gcc_rich_location::maybe_add_expr): Likewise.
      	(class text_range_label): New class.
      	(class range_label_for_type_mismatch): New class.
      	* gimple-ssa-sprintf.c (fmtwarn): Pass NULL for new label params
      	of format_warning_va.
      	(fmtwarn_n): Likewise for new params of format_warning_n_va.
      	* lto-wrapper.c (merge_and_complain): Add
      	OPT_fdiagnostics_show_labels to the "pick one setting" options.
      	(append_compiler_options): Likewise to the dropped options.
      	(append_diag_options): Likewise to the passed-on options.
      	* opts.c (common_handle_option): Handle the new option.
      	* selftest-diagnostic.c
      	(test_diagnostic_context::test_diagnostic_context): Enable
      	show_labels_p.
      	* substring-locations.c: Include "gcc-rich-location.h".
      	(format_warning_n_va): Add "fmt_label" and "param_label" params
      	and use them as appropriate.
      	(format_warning_va): Add "fmt_label" and "param_label" params,
      	passing them on to format_warning_n_va.
      	(format_warning_at_substring): Likewise.
      	(format_warning_at_substring_n): Likewise.
      	* substring-locations.h (format_warning_va): Add "fmt_label" and
      	"param_label" params.
      	(format_warning_n_va): Likewise.
      	(format_warning_at_substring): Likewise.
      	(format_warning_at_substring_n): Likewise.
      	* toplev.c (general_init): Initialize global_dc->show_labels_p.
      
      gcc/testsuite/ChangeLog:
      	* g++.dg/diagnostic/aka3.C: New test.
      	* g++.dg/diagnostic/param-type-mismatch-2.C: Update expected
      	output to show range labels.
      	* g++.dg/diagnostic/param-type-mismatch.C: Likewise.
      	* g++.dg/plugin/plugin.exp (plugin_test_list): Add...
      	* g++.dg/plugin/show-template-tree-color-labels.C: New test.
      	* gcc.dg/bad-binary-ops.c: Update expected output to show range
      	labels.  Add an "aka" example.
      	* gcc.dg/cpp/pr66415-1.c: Update expected output to show range
      	labels.
      	* gcc.dg/format/diagnostic-ranges.c: Likewise.
      	* gcc.dg/format/pr72858.c: Likewise.
      	* gcc.dg/format/pr78498.c: Likewise.
      	* gcc.dg/param-type-mismatch.c: Add "-Wpointer-sign" to options.
      	Update expected output to show range labels.  Add examples of
      	-Wincompatible-pointer-types and -Wpointer-sign for parameters.
      	* gcc.dg/plugin/diagnostic-test-show-locus-bw-line-numbers.c:
      	Update expected output to show range labels.
      	* gcc.dg/plugin/diagnostic-test-show-locus-bw.c: Likewise.
      	(test_very_wide_line): Adjust so that label is at left-clipping
      	boundary.
      	(test_very_wide_line_2): New test.
      	* gcc.dg/plugin/diagnostic-test-show-locus-color-line-numbers.c:
      	Update expected output to show range labels.
      	* gcc.dg/plugin/diagnostic-test-show-locus-color.c: Likewise.
      	* gcc.dg/plugin/diagnostic-test-show-locus-no-labels.c: New test.
      	* gcc.dg/plugin/diagnostic_plugin_show_trees.c (show_tree): Update
      	for new param to gcc_rich_location::add_expr.
      	* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c (add_range):
      	Add "label" param.
      	(test_show_locus): Add examples of labels to various tests.  Tweak
      	the "very wide_line" test case and duplicate it, to cover the
      	boundary values for clipping of labels against the left-margin.
      	* gcc.dg/plugin/plugin.exp (plugin_test_list): Add
      	diagnostic-test-show-locus-no-labels.c.
      	* gcc.dg/pr69554-1.c: Update expected output to show range labels.
      	Update line numbers of dg-locus directives.
      	* gcc.dg/pr69627.c:  Update expected output to show range labels.
      	* lib/multiline.exp (proc _build_multiline_regex): Remove
      	special-case handling of lines with trailing '|'.
      
      libcpp/ChangeLog:
      	* include/line-map.h (struct location_range): Add "m_label" field.
      	(class rich_location): Add description of labels to leading
      	comment.
      	(rich_location::rich_location): Add "label" param, defaulting to
      	NULL.
      	(rich_location::add_range): Likewise.
      	(struct label_text): New struct.
      	(class range_label): New abstract base class.
      	* line-map.c (rich_location::rich_location): Add "label" param;
      	use it.
      	(rich_location::add_range): Likewise.
      
      From-SVN: r263564
      David Malcolm committed
  18. 08 Aug, 2018 1 commit
    • [PATCH] line-map include-from representation · f10a9135
      https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00554.html
      	Make linemap::included_from a location
      	libcpp/
      	* include/line-map.h (struct line_map_ordinary): Replace
      	included_from map index with included_at source_location.
      	(ORDINARY_MAP_INCLUDER_FILE_INDEX): Delete.
      	(LAST_SOURCE_LINE_LOCATION): Delete.
      	(LAST_SOURCE_LINE, LAST_SOURCE_COLUMN): Delete.
      	(linemap_included_from): New.
      	(linemap_included_from_linemap): Declare.
      	(MAIN_FILE_P): Adjust.
      	* line-map.c (linemap_included_from_linemap): New.
      	(lonemap_check_files_exited): Use linemap_included_at.
      	(linemap_add): Adjust inclusion setting.
      	(linemap_dump, linemap_dump_location): Adjust.
      	* directives.c (do_linemarker): Use linemap_included_at.
      	gcc/
      	* diagnostic.c (diagnostic_report_current_module): Use
      	linemap_included_from & linemap_included_from_linemap.
      	gcc/c-family/
      	* c-common.c (try_to_locate_new_include_inertion_point): Use
      	linemap_included_from_linemap.
      	* c-lex.c (fe_file_change): Use linemap_included_from.
      	* c-ppoutput.c (pp_file_change): Likewise.
      	gcc/fortran/
      	* cpp.c (cb_file_change): Use linemap_included_from.
      	gcc/testsuite/
      	* c-c++-common/inc-from-1a.h, c-c++-common/inc-from-1b.h,
      	c-c++-common/inc-from-1.c: New
      
      From-SVN: r263429
      Nathan Sidwell committed
  19. 07 Aug, 2018 1 commit
  20. 25 Jul, 2018 1 commit
  21. 20 Jul, 2018 1 commit
    • libcpp: remove redundant parameter from rich_location::set_range · 181463c2
      gcc/c-family/ChangeLog:
      	* c-common.c (c_cpp_error): Remove redundant "line_table"
      	parameter from call to rich_location::set_range.
      	(maybe_suggest_missing_token_insertion): Likewise.
      
      gcc/ChangeLog:
      	* pretty-print.c (text_info::set_location): Remove redundant
      	"line_table" parameter from call to rich_location::set_range.
      
      libcpp/ChangeLog:
      	* include/line-map.h (rich_location::set_range): Remove redundant
      	line_maps * parameter.
      	* line-map.c (rich_location::set_range): Likewise.
      
      From-SVN: r262913
      David Malcolm committed
  22. 18 Jul, 2018 1 commit
    • re PR c/69558 (glib2 warning pragmas stopped working) · 6f41f92b
      libcpp:
      2018-07-18  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR 69558
              * macro.c (enter_macro_context): Change the location info for builtin
              macros and _Pragma from location of the closing parenthesis to location
              of the macro expansion point.
      
      testsuite:
      2018-07-18  Bernd Edlinger  <bernd.edlinger@hotmail.de>
      
              PR 69558
              * c-c++-common/cpp/diagnostic-pragma-2.c: New test.
              * c-c++-common/pr69558.c: Remove xfail.
              * gcc.dg/cpp/builtin-macro-1.c: Adjust test expectations.
              * gcc.dg/pr61817-1.c: Likewise.
              * gcc.dg/pr61817-2.c: Likewise.
              * g++.dg/plugin/pragma_plugin.c: Warn at expansion_point_location.
      
      From-SVN: r262861
      Bernd Edlinger committed