Go to file
David Malcolm 741d3be543 input.c: add lexing selftests and a test matrix for line_table states
This patch adds explicit testing of lexing a source file,
generalizing this (and the test of ordinary line maps) over
a 2-dimensional test matrix covering:

  (1) line_table->default_range_bits: some frontends use a non-zero value
  and others use zero

  (2) the fallback modes within line-map.c: there are various threshold
  values for source_location/location_t beyond line-map.c changes
  behavior (disabling of the range-packing optimization, disabling
  of column-tracking).  We exercise these by starting the line_table
  at interesting values at or near these thresholds.

This helps ensures that location data works in all of these states,
and that (I hope) we don't have lingering bugs relating to the
transition between line_table states.

gcc/ChangeLog:
	* input.c: Include cpplib.h.
	(selftest::temp_source_file): New class.
	(selftest::temp_source_file::temp_source_file): New ctor.
	(selftest::temp_source_file::~temp_source_file): New dtor.
	(selftest::should_have_column_data_p): New function.
	(selftest::test_should_have_column_data_p): New function.
	(selftest::temp_line_table): New class.
	(selftest::temp_line_table::temp_line_table): New ctor.
	(selftest::temp_line_table::~temp_line_table): New dtor.
	(selftest::test_accessing_ordinary_linemaps): Add case_ param; use
	it to create a temp_line_table.
	(selftest::assert_loceq): Only verify LOCATION_COLUMN for
	locations that are known to have column data.
	(selftest::line_table_case): New struct.
	(selftest::test_reading_source_line): Move tempfile handling
	to class temp_source_file.
	(ASSERT_TOKEN_AS_TEXT_EQ): New macro.
	(selftest::assert_token_loc_eq): New function.
	(ASSERT_TOKEN_LOC_EQ): New macro.
	(selftest::test_lexer): New function.
	(selftest::boundary_locations): New array.
	(selftest::input_c_tests): Call test_should_have_column_data_p.
	Loop over a test matrix of interesting values of location and
	default_range_bits, calling test_lexer on each case in the matrix.
	Move call to test_accessing_ordinary_linemaps into the matrix.
	* selftest.h (ASSERT_EQ): Reimplement in terms of...
	(ASSERT_EQ_AT): New macro.

gcc/testsuite/ChangeLog:
	* gcc.dg/plugin/location_overflow_plugin.c (plugin_init): Avoid
	hardcoding the values of LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES
	and LINE_MAP_MAX_LOCATION_WITH_COLS.

libcpp/ChangeLog:
	* include/line-map.h (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES):
	Move here from line-map.c.
	(LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise.
	* line-map.c (LINE_MAP_MAX_LOCATION_WITH_PACKED_RANGES): Move from
	here to line-map.h.
	(LINE_MAP_MAX_LOCATION_WITH_COLS): Likewise.

From-SVN: r238213
2016-07-11 16:02:20 +00:00
INSTALL
boehm-gc
config remove support for the interix target 2016-06-21 21:57:20 +00:00
contrib Dump profile-based number of iterations 2016-06-24 16:22:44 +00:00
fixincludes remove support for the interix target 2016-06-21 21:57:20 +00:00
gcc input.c: add lexing selftests and a test matrix for line_table states 2016-07-11 16:02:20 +00:00
gnattools configure.ac: Add ACX_NONCANONICAL_HOST. 2016-05-16 08:55:12 +00:00
gotools Update copyright dates 2016-06-07 08:54:22 +00:00
include gomp-constants.h (GOMP_VERSION): Increment to 1... 2016-05-26 09:12:59 +00:00
intl
libada
libatomic
libbacktrace re PR target/71161 (Lots of ASAN and libgo runtime FAILs after r236090) 2016-05-18 16:40:54 +02:00
libcc1 Update copyright dates 2016-06-07 08:54:22 +00:00
libcilkrts
libcpp input.c: add lexing selftests and a test matrix for line_table states 2016-07-11 16:02:20 +00:00
libdecnumber
libffi [PR libffi/65567] libffi: Fix, and simply libffi_feature_test 2016-05-23 16:54:04 +02:00
libgcc arm-arches.def (armv8-m.base): Define new architecture. 2016-07-07 08:54:40 +00:00
libgfortran re PR libfortran/48852 (Invalid spaces in list-directed output of complex constants) 2016-06-23 15:58:05 +00:00
libgo
libgomp Add 2 tests for PR middle-end/71734 2016-07-03 09:40:22 -07:00
libiberty Don't needlessly clear xmemdup allocated memory. 2016-05-31 20:38:54 +09:30
libitm
libjava libtool-version: Bump soversion. 2016-06-01 20:10:48 +00:00
libmpx mpx_wrappers.c (move_bounds): Fix overflow bug. 2016-06-10 09:23:53 +00:00
libobjc
liboffloadmic target.c (gomp_device_copy): New function. 2016-05-26 09:58:56 +00:00
libquadmath
libsanitizer re PR sanitizer/71160 (libasan: Backport support for malloc within dlsym) 2016-05-17 11:17:54 +02:00
libssp
libstdc++-v3 Implement std::optional. 2016-07-10 20:44:21 +03:00
libvtv
lto-plugin
maintainer-scripts generate_libstdcxx_web_docs: Use realpath to get absolute path. 2016-06-13 08:47:13 +01:00
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Add make autoprofiledbootstrap 2016-06-23 14:34:16 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS (Write After Approval): Add myself. 2016-06-18 13:26:36 +00:00
Makefile.def Add make autoprofiledbootstrap 2016-06-23 14:34:16 +00:00
Makefile.in Add make autoprofiledbootstrap 2016-06-23 14:34:16 +00:00
Makefile.tpl Add make autoprofiledbootstrap 2016-06-23 14:34:16 +00:00
README
compile
config-ml.in
config.guess config.guess: Import version 2016-04-02 (newest). 2016-05-16 16:13:37 -06:00
config.rpath
config.sub config.guess: Import version 2016-04-02 (newest). 2016-05-16 16:13:37 -06:00
configure configure.ac: Disable libgcj and libgloss for Phoenix-RTOS targets. 2016-06-23 07:12:16 +00:00
configure.ac configure.ac: Disable libgcj and libgloss for Phoenix-RTOS targets. 2016-06-23 07:12:16 +00:00
depcomp
install-sh
libtool-ldflags
libtool.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
symlink-tree
ylwrap

README

This directory contains the GNU Compiler Collection (GCC).

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

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

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

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

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.