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] Emit warning for function declaration with qualified void return type



On Jan 4, 2005, at 2:37 PM, Devang Patel wrote:


This patch enables pedantic warning, in c99 mode, for function declarations that has qualified void return type. GCC already emits warning for function definitions.

Bootstrapped and tested on powerpc-darwin.
This is a regression from earlier GCC.
--- 4182,4193 ----
Qualifiers on a void return type are banned on
function definitions in ISO C; GCC used to used
them for noreturn functions. */
! if (VOID_TYPE_P (type)) {
! if (really_funcdef)
! pedwarn ("function definition has qualified void return type");
! else if (flag_isoc99)
! pedwarn ("function declaration has qualified void return type");
! }

Would it not be better if we write this block of code like: if (really_funcdef || flag_isoc99) pedwarn ("function definition has qualified void return type");

Decreasing the number of times this is repeated and also makes the code
a little more readable?

Thanks,
Andrew Pinski


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