C/C++ diagnostics guidelines (was: Re: [C PATCH] Enable initializing statics with COMPOUND_LITERAL_EXPR in C99 (PR c/63567))
The Right Thing is for -pedantic not to cause errors, only warnings (-pedantic-errors being needed for an error). So rather than having this conditional for whether to allow the extension at all, make the conditional code do a pedwarn (if flag_isoc99, otherwise there will already have been one for using a compound literal at all, and not for VECTOR_TYPE). (I don't believe this can affect the semantics of valid code; in this case of require_constant with a compound literal, we know the code is invalid in ISO C terms, so it's safe to diagnose it then interpret it in a sensible way.) I think there is roughly consensus about how C/C++ diagnostics should work, but it is easy to forget it since it is not really written anywhere. Thus, I drafted some guidelines at:https://gcc.gnu.org/wiki/Better_Diagnostics#guidelines Please, could you take a look and comment whether I got it right/wrong? New items are very welcome! Cheers, Manuel.
Re: C/C++ diagnostics guidelines (was: Re: [C PATCH] Enable initializing statics with COMPOUND_LITERAL_EXPR in C99 (PR c/63567))
On Fri, 17 Oct 2014, Manuel López-Ibáñez wrote: Thus, I drafted some guidelines at:https://gcc.gnu.org/wiki/Better_Diagnostics#guidelines Please, could you take a look and comment whether I got it right/wrong? Yes, that looks right to me. -- Joseph S. Myers jos...@codesourcery.com
Re: C/C++ diagnostics guidelines (was: Re: [C PATCH] Enable initializing statics with COMPOUND_LITERAL_EXPR in C99 (PR c/63567))
On 17 October 2014 19:33, Joseph S. Myers jos...@codesourcery.com wrote: On Fri, 17 Oct 2014, Manuel López-Ibáñez wrote: Thus, I drafted some guidelines at:https://gcc.gnu.org/wiki/Better_Diagnostics#guidelines Please, could you take a look and comment whether I got it right/wrong? Yes, that looks right to me. Thanks! I added guidelines also about locations and warning options. Cheers, Manuel.
Re: C/C++ diagnostics guidelines (was: Re: [C PATCH] Enable initializing statics with COMPOUND_LITERAL_EXPR in C99 (PR c/63567))
On 17 October 2014 20:04, Manuel López-Ibáñez lopeziba...@gmail.com wrote: On 17 October 2014 19:33, Joseph S. Myers jos...@codesourcery.com wrote: On Fri, 17 Oct 2014, Manuel López-Ibáñez wrote: Thus, I drafted some guidelines at:https://gcc.gnu.org/wiki/Better_Diagnostics#guidelines Please, could you take a look and comment whether I got it right/wrong? Yes, that looks right to me. Thanks! I added guidelines also about locations and warning options. I believe there are also some rules about when to use some special line-map functions that arise when warning about macros like NULL, but I am not aware of the specifics. It would be useful if someone added those. Dodji, Paolo? Do you know what I'm talking about? Cheers, Manuel.