delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/26/14:52:58

Date: Fri, 26 Dec 1997 11:52:40 -0800 (PST)
Message-Id: <199712261952.LAA12174@adit.ap.net>
Mime-Version: 1.0
To: Noam Rotem <nrotem AT johnbryce DOT co DOT il>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Filtering warnings

At 01:31  12/26/1997 PST, Noam Rotem wrote:
>Hi,
>
>When I'm using the -Wall switch, I get also the warning about 
>main, defaulting to 'int'...
>
>Is there anyway (except for using 'int main' of course)
>to get rid of this particular warning when using -Wall? Maybe 
>another switch which filters some warnings out?
I don't know of any way. IMHO, people who use `void main' deserve the
warnings. Either don't do that, or ignore them.

Strangely, I can't get the warnings myself. Compiling this program:

#include <stdio.h>
void main(void) { printf("Hello, world"); }

yields no warnings, even with `-Wall' and/or `-W'. I am using GCC 2.7.2.1
recompiled from source with stabs patch.
I investigated this, and found that generating warnings for `main' and
having it return 0 is predicated on a macro called `DEFAULT_MAIN_RETURN'
being defined in c-decl.c of the GCC sources. A `grep' through the entire
tree found no definition of this macro. Therefore, I am confused as to how
anyone can get the `void main' warnings.
Any thoughts welcome

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019