This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch to implement C99 flexible array member constraints


On 17 Aug 2002, Gabriel Dos Reis wrote:

> "Joseph S. Myers" <jsm28@cam.ac.uk> writes:
> 
> [...]
> 
> | @@ -5216,6 +5254,11 @@ finish_struct (t, fieldlist, attributes)
> |  	  else if (! saw_named_field)
> |  	    error_with_decl (x, "flexible array member in otherwise empty struct");
> 
> New codes should not use {error, warning, pedwarn}_withe_decl.
> Please change that to use error() or warning() or pedwran().

What you quote is not new code.

> | +      if (pedantic && TREE_CODE (t) == RECORD_TYPE
> | +	  && flexible_array_type_p (TREE_TYPE (x)))
> | +	pedwarn_with_decl (x, "invalid use of structure with flexible array member");
> 
> Ditto.

This is following the style of the surrounding code (some of which you
quoted).  Style conversion is best done wholesale (i.e., converting the
whole C front end (and rest of compiler) at once, then removing the old
functions).

What is the right way to specify to error() or warning() or pedwarn() that
a DECL should be used to determine the source location at which an error
is reported (which is what the _with_decl functions are used for here),
whether or not that DECL is also named in the message?

I can't find documentation that the _with_decl interfaces are obsolete:  
not by the declarations of the functions, nor by their definitions, nor in
codingconventions.html.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]