Commit 0b2c4be5 by Dodji Seketeli Committed by Dodji Seketeli

PR preprocessor/7263 - Avoid pedantic warnings on system headers macro tokens

Now that we track token locations accross macro expansions, it would
be cool to be able to fix PR preprocessor/7263 for real.  That is,
consider this example where we have a system header named header.h
like this:

	#define _Complex __complex__ #define _Complex_I 1.0iF

and then a normal C file like this:

    #include "header.h"

    static _Complex float c = _Complex_I;

If we compile the file with -pedantic, the usages of _Complex or
_Complex_I should not trigger any warning, even though __complex__ and
the complex literal are extensions to the standard C.

They shouldn't trigger any warning because _Complex and _Complex_I are
defined in a system header (and expanded in normal user code).

To be able to handle this, we must address two separate concerns.

First, warnings about non-standard usage of numerical literals are emitted
directly from within libcpp.  So we must teach libcpp's parser for numerical
literals to use virtual locations, instead of the spelling
location it uses today.  Once we have that, as the diagnostics machinery
already knows how to avoid emitting errors happening on tokens that come from
system headers, we win.

Second, there is the issue of tracking locations for declaration
specifiers, like the "_Complex" in the declaration:

	static _Complex float c;

For that, we need to arrange for each possible declaration specifier
to have its own location, because otherwise, we'd warn on e.g, on:

    _Complex float c;

but not on:

    static _Complex float c;

So this patch addresses the two concerns above.  It's actually a
follow-up on an earlier patch[1] I wrote as part of my initial work on
virtual locations.  We then agreed[2] that the second concern was
important to address before the patch could get a chance to go in.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00957.html
[2]: http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00264.html

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

libcpp/

	PR preprocessor/7263
	* include/cpplib.h (cpp_classify_number): Take a location
	parameter.
	* expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic
	macros that take a location parameter.
	(cpp_classify_number): Take a (virtual) location parameter.  Use
	it for diagnostics.  Adjust comments.
	(eval_token): Take a location parameter.  Pass it to
	cpp_classify_number and to diagnostic routines.
	(_cpp_parse_expr): Use virtual locations of tokens when parsing
	expressions.  Pass a virtual location to eval_token and to
	diagnostic routines.

gcc/c-family/

	PR preprocessor/7263
	* c-lex.c (c_lex_with_flags):  Pass a virtual location to the call
	to cpp_classify_number.  For diagnostics, use the precise location
	instead of the global input_location.

gcc/
	PR preprocessor/7263
	* c-tree.h (enum c_declspec_word): Declare new enum.
	(struct c_declspecs::locations): New member.
	(declspecs_add_qual, declspecs_add_scspec)
	(declspecs_add_addrspace, declspecs_add_alignas): Take a new
	location parameter.
	* c-decl.c (build_null_declspecs): Initialize the new struct
	c_declspecs::locations member.
	(declspecs_add_addrspace): Take a location parameter for the
	address space.  Store it onto declaration specifiers.
	(declspecs_add_qual): Likewise, take a location parameter for the
	qualifier.
	(declspecs_add_type): Likewise, take a location parameter for the
	type specifier.
	(declspecs_add_scspec): Likewise, take a location parameter for
	the storage class specifier.
	(declspecs_add_attrs): Likewise, take a location parameter for the
	first attribute.
	(declspecs_add_alignas): Likewise, take a location parameter for
	the alignas token.
	(finish_declspecs): For diagnostics, use the location of the
	relevant declspec, instead of the global input_location.
	* c-parser.c (c_parser_parameter_declaration): Pass the precise
	virtual location of the declspec to the declspecs-setters.
	(c_parser_declspecs): Likewise.  Avoid calling c_parser_peek_token
	repeatedly.

gcc/cp/

	PR preprocessor/7263
	* cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all
	the possible declarator specifiers so far.
	(struct cp_decl_specifier_seq::locations): Declare new member.
	(cp_decl_specifier_seq::{specs, type_location}): Remove.
	(decl_spec_seq_has_spec_p): Declare new function.
	* parser.c (cp_parser_check_decl_spec): Remove.
	(set_and_check_decl_spec_loc): Define new static function.
	(decl_spec_seq_has_spec_p): Define new public function.
	(cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt)
	(cp_parser_type_specifier, cp_parser_simple_type_specifier)
	(cp_parser_set_storage_class, cp_parser_set_decl_spec_type)
	(cp_parser_alias_declaration): Set the locations for each
	declspec, using set_and_check_decl_spec_loc.
	(cp_parser_explicit_instantiation, cp_parser_init_declarator)
	(cp_parser_member_declaration, cp_parser_init_declarator): Use the
	new declspec location for specifiers.  Use the new
	decl_spec_seq_has_spec_p.
	(cp_parser_type_specifier_seq): Use the new
	set_and_check_decl_spec_loc.  Stop using
	cp_parser_check_decl_spec.  Use the new decl_spec_seq_has_spec_p.
	(, cp_parser_init_declarator): Use the new
	set_and_check_decl_spec_loc.
	(cp_parser_single_declaration, cp_parser_friend_p)
	(cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration):
	Use the new decl_spec_seq_has_spec_p.
	* decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p.  Use
	the more precise ds_redefined_builtin_type_spec location for
	diagnostics about re-declaring C++ built-in types.
	(start_decl, grokvardecl, grokdeclarator): Use the new
	decl_spec_seq_has_spec_p.

gcc/testsuite/

	PR preprocessor/7263
	* gcc.dg/binary-constants-2.c: Run without tracking locations
	accross macro expansion.
	* gcc.dg/binary-constants-3.c: Likewise.
	* gcc.dg/cpp/sysmac2.c: Likewise.
	* testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise
	location.
	* gcc.dg/cpp/syshdr3.c: New test.
	* gcc.dg/cpp/syshdr3.h: New header for the new test above.
	* gcc.dg/system-binary-constants-1.c: New test.
	* gcc.dg/system-binary-constants-1.h: New header for the new test
	above.
	* g++.dg/cpp/syshdr3.C: New test.
	* g++.dg/cpp/syshdr3.h: New header the new test above.
	* g++.dg/system-binary-constants-1.C: New test.
	* g++.dg/system-binary-constants-1.h: New header the new test
	above.

From-SVN: r187587
parent 40295cc7
2012-05-16 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/7263
* c-tree.h (enum c_declspec_word): Declare new enum.
(struct c_declspecs::locations): New member.
(declspecs_add_qual, declspecs_add_scspec)
(declspecs_add_addrspace, declspecs_add_alignas): Take a new
location parameter.
* c-decl.c (build_null_declspecs): Initialize the new struct
c_declspecs::locations member.
(declspecs_add_addrspace): Take a location parameter for the
address space. Store it onto declaration specifiers.
(declspecs_add_qual): Likewise, take a location parameter for the
qualifier.
(declspecs_add_type): Likewise, take a location parameter for the
type specifier.
(declspecs_add_scspec): Likewise, take a location parameter for
the storage class specifier.
(declspecs_add_attrs): Likewise, take a location parameter for the
first attribute.
(declspecs_add_alignas): Likewise, take a location parameter for
the alignas token.
(finish_declspecs): For diagnostics, use the location of the
relevant declspec, instead of the global input_location.
* c-parser.c (c_parser_parameter_declaration): Pass the precise
virtual location of the declspec to the declspecs-setters.
(c_parser_declspecs): Likewise. Avoid calling c_parser_peek_token
repeatedly.
2012-05-16 Igor Zamyatin <igor.zamyatin@intel.com>
* configure.ac: Stack protector enabling for Android targets.
......
2012-05-16 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/7263
* c-lex.c (c_lex_with_flags): Pass a virtual location to the call
to cpp_classify_number. For diagnostics, use the precise location
instead of the global input_location.
2012-05-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/11856
......
......@@ -315,7 +315,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags,
case CPP_NUMBER:
{
const char *suffix = NULL;
unsigned int flags = cpp_classify_number (parse_in, tok, &suffix);
unsigned int flags = cpp_classify_number (parse_in, tok, &suffix, *loc);
switch (flags & CPP_N_CATEGORY)
{
......@@ -417,7 +417,7 @@ c_lex_with_flags (tree *value, location_t *loc, unsigned char *cpp_flags,
*cpp_spell_token (parse_in, tok, name, true) = 0;
error ("stray %qs in program", name);
error_at (*loc, "stray %qs in program", name);
}
goto retry;
......
......@@ -2015,14 +2015,15 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
if (c_parser_next_token_is (parser, CPP_NAME))
{
tree value = c_parser_peek_token (parser)->value;
c_id_kind kind = c_parser_peek_token (parser)->id_kind;
c_token *name_token = c_parser_peek_token (parser);
tree value = name_token->value;
c_id_kind kind = name_token->id_kind;
if (kind == C_ID_ADDRSPACE)
{
addr_space_t as
= c_parser_peek_token (parser)->keyword - RID_FIRST_ADDR_SPACE;
declspecs_add_addrspace (specs, as);
= name_token->keyword - RID_FIRST_ADDR_SPACE;
declspecs_add_addrspace (name_token->location, specs, as);
c_parser_consume_token (parser);
attrs_ok = true;
continue;
......@@ -2068,7 +2069,7 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
}
t.expr = NULL_TREE;
t.expr_const_operands = true;
declspecs_add_type (loc, specs, t);
declspecs_add_type (name_token->location, specs, t);
continue;
}
if (c_parser_next_token_is (parser, CPP_LESS))
......@@ -2104,7 +2105,8 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
/* TODO: Distinguish between function specifiers (inline, noreturn)
and storage class specifiers, either here or in
declspecs_add_scspec. */
declspecs_add_scspec (specs, c_parser_peek_token (parser)->value);
declspecs_add_scspec (loc, specs,
c_parser_peek_token (parser)->value);
c_parser_consume_token (parser);
break;
case RID_UNSIGNED:
......@@ -2171,18 +2173,18 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
case RID_VOLATILE:
case RID_RESTRICT:
attrs_ok = true;
declspecs_add_qual (specs, c_parser_peek_token (parser)->value);
declspecs_add_qual (loc, specs, c_parser_peek_token (parser)->value);
c_parser_consume_token (parser);
break;
case RID_ATTRIBUTE:
if (!attrs_ok)
goto out;
attrs = c_parser_attributes (parser);
declspecs_add_attrs (specs, attrs);
declspecs_add_attrs (loc, specs, attrs);
break;
case RID_ALIGNAS:
align = c_parser_alignas_specifier (parser);
declspecs_add_alignas (specs, align);
declspecs_add_alignas (loc, specs, align);
break;
default:
goto out;
......@@ -3332,7 +3334,7 @@ c_parser_parameter_declaration (c_parser *parser, tree attrs)
specs = build_null_declspecs ();
if (attrs)
{
declspecs_add_attrs (specs, attrs);
declspecs_add_attrs (input_location, specs, attrs);
attrs = NULL_TREE;
}
c_parser_declspecs (parser, specs, true, true, true, cla_nonabstract_decl);
......
......@@ -222,8 +222,45 @@ enum c_typespec_keyword {
cts_accum
};
/* A sequence of declaration specifiers in C. */
/* This enum lists all the possible declarator specifiers, storage
class or attribute that a user can write. There is at least one
enumerator per possible declarator specifier in the struct
c_declspecs below.
It is used to index the array of declspec locations in struct
c_declspecs. */
enum c_declspec_word {
cdw_typespec /* A catch-all for a typespec. */,
cdw_storage_class /* A catch-all for a storage class */,
cdw_attributes,
cdw_typedef,
cdw_explicit_signed,
cdw_deprecated,
cdw_default_int,
cdw_long,
cdw_long_long,
cdw_short,
cdw_signed,
cdw_unsigned,
cdw_complex,
cdw_inline,
cdw_noreturn,
cdw_thread,
cdw_const,
cdw_volatile,
cdw_restrict,
cdw_saturating,
cdw_alignas,
cdw_address_space,
cdw_number_of_elements /* This one must always be the last
enumerator. */
};
/* A sequence of declaration specifiers in C. When a new declaration
specifier is added, please update the enum c_declspec_word above
accordingly. */
struct c_declspecs {
source_location locations[cdw_number_of_elements];
/* The type specified, if a single type specifier such as a struct,
union or enum specifier, typedef name or typeof specifies the
whole type, or NULL_TREE if none or a keyword such as "void" or
......@@ -509,15 +546,20 @@ extern struct c_declarator *build_id_declarator (tree);
extern struct c_declarator *make_pointer_declarator (struct c_declspecs *,
struct c_declarator *);
extern struct c_declspecs *build_null_declspecs (void);
extern struct c_declspecs *declspecs_add_qual (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_qual (source_location,
struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_type (location_t,
struct c_declspecs *,
struct c_typespec);
extern struct c_declspecs *declspecs_add_scspec (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_attrs (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_addrspace (struct c_declspecs *,
extern struct c_declspecs *declspecs_add_scspec (source_location,
struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_attrs (source_location,
struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_addrspace (source_location,
struct c_declspecs *,
addr_space_t);
extern struct c_declspecs *declspecs_add_alignas (struct c_declspecs *, tree);
extern struct c_declspecs *declspecs_add_alignas (source_location,
struct c_declspecs *, tree);
extern struct c_declspecs *finish_declspecs (struct c_declspecs *);
/* in c-objc-common.c */
......
2012-05-16 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/7263
* cp-tree.h (enum cp_decl_spec): Add new enumerators to cover all
the possible declarator specifiers so far.
(struct cp_decl_specifier_seq::locations): Declare new member.
(cp_decl_specifier_seq::{specs, type_location}): Remove.
(decl_spec_seq_has_spec_p): Declare new function.
* parser.c (cp_parser_check_decl_spec): Remove.
(set_and_check_decl_spec_loc): Define new static function.
(decl_spec_seq_has_spec_p): Define new public function.
(cp_parser_decl_specifier_seq, cp_parser_function_specifier_opt)
(cp_parser_type_specifier, cp_parser_simple_type_specifier)
(cp_parser_set_storage_class, cp_parser_set_decl_spec_type)
(cp_parser_alias_declaration): Set the locations for each
declspec, using set_and_check_decl_spec_loc.
(cp_parser_explicit_instantiation, cp_parser_init_declarator)
(cp_parser_member_declaration, cp_parser_init_declarator): Use the
new declspec location for specifiers. Use the new
decl_spec_seq_has_spec_p.
(cp_parser_type_specifier_seq): Use the new
set_and_check_decl_spec_loc. Stop using
cp_parser_check_decl_spec. Use the new decl_spec_seq_has_spec_p.
(, cp_parser_init_declarator): Use the new
set_and_check_decl_spec_loc.
(cp_parser_single_declaration, cp_parser_friend_p)
(cp_parser_objc_class_ivars, cp_parser_objc_struct_declaration):
Use the new decl_spec_seq_has_spec_p.
* decl.c (check_tag_decl): Use new decl_spec_seq_has_spec_p. Use
the more precise ds_redefined_builtin_type_spec location for
diagnostics about re-declaring C++ built-in types.
(start_decl, grokvardecl, grokdeclarator): Use the new
decl_spec_seq_has_spec_p.
2012-05-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/11856
......
......@@ -4647,7 +4647,9 @@ typedef enum cp_storage_class {
sc_mutable
} cp_storage_class;
/* An individual decl-specifier. */
/* An individual decl-specifier. This is used to index the array of
locations for the declspecs in struct cp_decl_specifier_seq
below. */
typedef enum cp_decl_spec {
ds_first,
......@@ -4667,17 +4669,20 @@ typedef enum cp_decl_spec {
ds_constexpr,
ds_complex,
ds_thread,
ds_last
ds_type_spec,
ds_redefined_builtin_type_spec,
ds_attribute,
ds_storage_class,
ds_long_long,
ds_last /* This enumerator must always be the last one. */
} cp_decl_spec;
/* A decl-specifier-seq. */
typedef struct cp_decl_specifier_seq {
/* The number of times each of the keywords has been seen. */
unsigned specs[(int) ds_last];
/* The location of the primary type. Mainly used for error
reporting. */
location_t type_location;
/* An array of locations for the declaration sepecifiers, indexed by
enum cp_decl_spec_word. */
source_location locations[ds_last];
/* The primary type, if any, given by the decl-specifier-seq.
Modifiers, like "short", "const", and "unsigned" are not
reflected here. This field will be a TYPE, unless a typedef-name
......@@ -4827,6 +4832,8 @@ struct GTY((chain_next ("%h.next"))) tinst_level {
bool in_system_header_p;
};
bool decl_spec_seq_has_spec_p (const cp_decl_specifier_seq *, cp_decl_spec);
/* Return the type of the `this' parameter of FNTYPE. */
static inline tree
......
......@@ -864,7 +864,7 @@ grokfield (const cp_declarator *declarator,
cplus_decl_attributes (&value, attrlist, attrflags);
}
if (declspecs->specs[(int)ds_typedef]
if (decl_spec_seq_has_spec_p (declspecs, ds_typedef)
&& TREE_TYPE (value) != error_mark_node
&& TYPE_NAME (TYPE_MAIN_VARIANT (TREE_TYPE (value))) != value)
set_underlying_type (value);
......
2012-05-16 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/7263
* gcc.dg/binary-constants-2.c: Run without tracking locations
accross macro expansion.
* gcc.dg/binary-constants-3.c: Likewise.
* gcc.dg/cpp/sysmac2.c: Likewise.
* testsuite/gcc.dg/nofixed-point-2.c: Adjust for more precise
location.
* gcc.dg/cpp/syshdr3.c: New test.
* gcc.dg/cpp/syshdr3.h: New header for the new test above.
* gcc.dg/system-binary-constants-1.c: New test.
* gcc.dg/system-binary-constants-1.h: New header for the new test
above.
* g++.dg/cpp/syshdr3.C: New test.
* g++.dg/cpp/syshdr3.h: New header the new test above.
* g++.dg/system-binary-constants-1.C: New test.
* g++.dg/system-binary-constants-1.h: New header the new test
above.
2012-05-15 Paolo Carlini <paolo.carlini@oracle.com>
* g++.old-deja/g++.pt/crash10.C: Adjust post PR11586.
......
/* Contributed by Dodji Seketeli <dodji@redhat.com> */
/* Origin: PR preprocessor/7263 */
/* { dg-options "-pedantic -std=c++98 -ftrack-macro-expansion=1" } */
/* { dg-do compile } */
/* This tests the proprer suppression of warning coming from macro
defined in system headers and expanded in a non-system header
location. */
#include "syshdr3.h"
static _Complex float c = _Complex_I + _Complex_I; /* These macros are defined in
system header so we should
have no warning here. */
U_LL u = ONE_ULL; /* Likewise here. */
unsigned long long v = 1ULL; /* { dg-warning "long long" } */
#pragma GCC system_header
#define _Complex __complex__
#define _Complex_I 1.0iF
#define U_LL unsigned long long
#define ONE_ULL 1ULL
/*
Origin: Dodji Seketeli <dodji@redhat.com>
{ dg-options "-std=c++98 -pedantic" }
{ dg-do compile }
*/
#include "system-binary-constants-1.h"
int
foo (void)
{
#if BINARY_INT_CONSTANT_IN_SYSTEM_HEADER /* A binary constant defined
in system header. No
warning. */
return 23;
#endif
return 0b1101; /* { dg-warning "binary constants are a GCC extension" } */
}
#pragma GCC system_header
#define BINARY_INT_CONSTANT_IN_SYSTEM_HEADER 0b1101
......@@ -2,7 +2,7 @@
/* Origin: Joerg Wunsch <j.gnu@uriah.heep.sax.de>. */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic" } */
/* { dg-options "-std=iso9899:1999 -pedantic -ftrack-macro-expansion=0" } */
#define FOO 0b1101
......
......@@ -2,7 +2,7 @@
/* Origin: Joerg Wunsch <j.gnu@uriah.heep.sax.de>. */
/* { dg-do compile } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
/* { dg-options "-std=iso9899:1999 -pedantic-errors -ftrack-macro-expansion=0" } */
#define FOO 0b1101
......
/* PR 7263: __extension__ keyword doesn't suppress warning on LL or ULL constants. */
/* { dg-do compile } */
/* { dg-options "-std=c99 -pedantic-errors" } */
/* { dg-options "-std=c99 -pedantic-errors -ftrack-macro-expansion=0" } */
#include "pr7263-3.h"
__complex__ bar () /* { dg-error "ISO C does not support plain .complex. meaning .double complex." } */
{
......
/* Contributed by Dodji Seketeli <dodji@redhat.com> */
/* Origin: PR preprocessor/7263 */
/* { dg-options "-pedantic -std=c89 -ftrack-macro-expansion=1" } */
/* { dg-do compile } */
/* This tests the proprer suppression of warning coming from macro
defined in system headers and expanded in a non-system header
location. */
#include "syshdr3.h"
static _Complex float c = _Complex_I + _Complex_I; /* These macros are defined in
system header so we should
have no warning here. */
U_LL u = ONE_ULL; /* Likewise here. */
unsigned long long v = 1ULL; /* { dg-warning "long long" } */
#pragma GCC system_header
#define _Complex __complex__
#define _Complex_I 1.0iF
#define U_LL unsigned long long
#define ONE_ULL 1ULL
/* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do preprocess } */
/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */
/* { dg-options "-std=gnu99 -pedantic -Wtraditional -ftrack-macro-expansion=0" } */
/* Tests diagnostics are suppressed for some macros defined in system
headers. */
......
/* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -pedantic -Wtraditional" } */
/* { dg-options "-std=gnu99 -pedantic -Wtraditional -ftrack-macro-expansion=0" } */
/* Tests diagnostics are suppressed for some macros defined in system
headers. */
......
......@@ -20,10 +20,10 @@ f3 (void)
return 0k; /* { dg-error "not supported" "reject fixed-point" } */
}
_Sat
f4 (void) /* { dg-error "not supported" "reject fixed-point" } */
_Sat /* { dg-error "not supported" "reject fixed-point" } */
f4 (void)
{
return 0k; /* { dg-error "not supported" "reject fixed-point" } */
}
/* { dg-error "is used without" "" { target *-*-* } 24 } */
/* { dg-error "is used without" "" { target *-*-* } 23 } */
/*
Origin: Dodji Seketeli <dodji@redhat.com>
{ dg-options "-std=iso9899:1999 -pedantic" }
{ dg-do compile }
*/
#include "system-binary-constants-1.h"
int
foo (void)
{
#if BINARY_INT_CONSTANT_IN_SYSTEM_HEADER /* A binary constant defined
in system header. No
warning. */
return 23;
#endif
return 0b1101; /* { dg-warning "binary constants are a GCC extension" } */
}
#pragma GCC system_header
#define BINARY_INT_CONSTANT_IN_SYSTEM_HEADER 0b1101
2012-05-16 Dodji Seketeli <dodji@redhat.com>
PR preprocessor/7263
* include/cpplib.h (cpp_classify_number): Take a location
parameter.
* expr.c (SYNTAX_ERROR_AT, SYNTAX_ERROR2_AT): New diagnostic
macros that take a location parameter.
(cpp_classify_number): Take a (virtual) location parameter. Use
it for diagnostics. Adjust comments.
(eval_token): Take a location parameter. Pass it to
cpp_classify_number and to diagnostic routines.
(_cpp_parse_expr): Use virtual locations of tokens when parsing
expressions. Pass a virtual location to eval_token and to
diagnostic routines.
2012-05-10 Tristan Gingold <gingold@adacore.com>
* expr.c (interpret_float_suffix): Add a guard.
......
......@@ -851,7 +851,7 @@ struct cpp_num
/* Classify a CPP_NUMBER token. The return value is a combination of
the flags from the above sets. */
extern unsigned cpp_classify_number (cpp_reader *, const cpp_token *,
const char **);
const char **, source_location);
/* Return the classification flags for a float suffix. */
extern unsigned int cpp_interpret_float_suffix (const char *, size_t);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment