This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Emit warning for function declaration with qualified void return type
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Devang Patel <dpatel at apple dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 4 Jan 2005 14:41:03 -0500
- Subject: Re: [PATCH] Emit warning for function declaration with qualified void return type
- References: <00999771-5E88-11D9-ABDE-000393A91CAA@apple.com>
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