GCC modified for the FreeChainXenon project
Find a file
Dodji Seketeli f3d25c6570 PR preprocessor/53469 - argument tokens of _Pragma miss virtual location
Consider this short test snippet:

-------------------------8-------------------
    #define STRINGIFY(x) #x
    #define TEST(x) \
      _Pragma(STRINGIFY(GCC diagnostic ignored "-Wunused-local-typedefs")) \
      typedef int myint;

    void bar ()
    {
      TEST(myint)
    }
-------------------------8-------------------

The _Pragma is effectively ignored, and compiling with
-Wunused-local-typedefs warns on the local typedef, even though the
pragma should have prevented the warning to be emitted.

This is because when the preprocessor sees the _Pragma operator and
then goes to handle the first token ('GCC' here) that makes up its
operands, it retains the spelling location of that token, not its
virtual location.

Later when diagnostic_report_diagnostic is called to emit the warning
(or ignore it because of the pragma), it compares the location of the
first operand of the pragma with the location of the unused location,
(by calling linemap_location_before_p) and that comparison fails
because in this case, both locations should be virtual.

This patch fixes the issue by teaching the pragma handling to use
virtual locations.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

libcpp/

	PR preprocessor/53469
	* directives.c (do_pragma): Use the virtual location for the
	pragma token, instead of its spelling location.

gcc/testsuite/

	PR preprocessor/53469
	* gcc.dg/cpp/_Pragma7.c: New test case.

From-SVN: r190714
2012-08-27 17:41:38 +02:00
boehm-gc Regenerate configure files for libtool.m4 change 2012-05-16 15:11:18 -07:00
config Move config entries to ChangeLog 2012-08-26 07:26:57 -07:00
contrib * btest-gcc.sh (TESTLOGS): Make gfortran.sum optional. 2012-08-26 19:30:44 +00:00
fixincludes inclhack.def (aix_mutex_initializer_1): New fix. 2012-06-19 13:55:14 -04:00
gcc PR preprocessor/53469 - argument tokens of _Pragma miss virtual location 2012-08-27 17:41:38 +02:00
gnattools Remove obsolete IRIX 6.5 support 2012-03-14 16:33:37 +00:00
include Sync plugin-api.h with gold patch : http://sourceware.org/ml/binutils/2012-08/msg00447.html 2012-08-24 19:07:28 +00:00
INSTALL README: Also refer to the online installation instructions. 2012-08-25 20:48:20 +00:00
intl
libada Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET). 2012-06-11 15:24:12 +00:00
libatomic re PR other/53231 (libatomic/tas_n.c💯10: error: 'ret' undeclared (first use in this function)) 2012-05-22 23:54:32 +00:00
libcpp PR preprocessor/53469 - argument tokens of _Pragma miss virtual location 2012-08-27 17:41:38 +02:00
libdecnumber warnings.m4 (ACX_PROG_CC_WARNING_OPTS): Avoid leading dash in expr call. 2011-12-20 16:54:12 +00:00
libffi re PR libffi/53014 (libffi failures on mips64-linux-gnu with soft-float) 2012-08-26 11:29:21 -07:00
libgcc re PR target/54222 ([avr] Implement fixed-point support) 2012-08-24 13:01:54 +00:00
libgfortran list_read.c (list_formatted_read_scalar): Fix copying real value back to temporary. 2012-07-25 16:40:26 +00:00
libgo compiler: Remove old handling of unsafe.Pointer in type assertions. 2012-08-23 00:20:48 +00:00
libgomp libgomp.texi (Library Index): Renamed from "Index" to prevent conflict with index.html on case-insensitive... 2012-07-04 22:53:03 -04:00
libiberty floatformat.c (floatformat_to_double): Correctly handle numbers between 1 and 2. 2012-08-17 21:56:48 +00:00
libitm xmmintrin.h (_mm_sfence): Use __builtin_ia32_pause. 2012-07-03 09:24:10 +02:00
libjava Use accessor functions to manipulate xmlOutputBuffer 2012-08-09 12:33:48 +02:00
libmudflap ctors.exp: Explicitely specify -O0. 2012-07-13 13:25:13 +00:00
libobjc eh_personality.cc (__gxx_personality_seh0): New function. 2012-07-19 07:29:24 +00:00
libquadmath re PR target/51007 (Quadmath I/O doesn't work on MinGW) 2012-05-31 18:51:27 +00:00
libssp re PR target/51007 (Quadmath I/O doesn't work on MinGW) 2012-05-31 18:51:27 +00:00
libstdc++-v3 Add interfaces to retrieve random numbers in bulk. 2012-08-27 14:13:15 +00:00
lto-plugin * lto-plugin.c: Fix typo. 2012-05-29 20:21:25 +01:00
maintainer-scripts crontab: Disable snapshots from gcc-4_5-branch. 2012-07-02 09:16:29 +00:00
zlib Regenerate configure files for libtool.m4 change 2012-05-16 15:11:18 -07:00
ABOUT-NLS
ChangeLog MAINTAINERS: Fix my email address. 2012-08-27 12:00:32 +00:00
ChangeLog.tree-ssa
compile
config-ml.in
config.guess oops - omitted from previous delta. 2011-06-06 10:34:35 +00:00
config.rpath
config.sub Update config.sub to 2012-04-18 version from official repo. 2012-04-25 15:48:28 +00:00
configure cloog.m4 (CLOOG_INIT_FLAGS): Use = instead of == in test. 2012-08-26 12:20:01 +00:00
configure.ac backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... 2012-08-14 21:56:07 -04:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 Add x32 support to libtool.m4 2012-05-15 09:07:28 -07:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS MAINTAINERS: Fix my email address. 2012-08-27 12:00:32 +00:00
Makefile.def Don't set HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes 2012-08-26 07:40:22 -07:00
Makefile.in Don't set HOST_LIB_PATH_bfd/HOST_LIB_PATH_opcodes 2012-08-26 07:40:22 -07:00
Makefile.tpl backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... 2012-08-14 21:56:07 -04:00
missing
mkdep
mkinstalldirs
move-if-change
README * README: Document use of ranges of years in copyright notices. 2012-07-16 15:01:34 +01:00
symlink-tree
ylwrap

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.