From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Seebach To: egcs@cygnus.com Subject: Huh? Date: Tue, 19 Aug 1997 17:54:31 -0000 Message-id: <199708191611.LAA03742@monolith.solon.com> X-SW-Source: 1997-08/0160.html I'm curious about this... I submitted some patches, some time ago, to add warnings for non-int-main. They have all been changed to "pedwarn". All of my belief that "-pedantic" should be the default aside, this is Just Plain Wrong. Why? Because, it is a flat out *bug* that gcc -Wmain will not warn for suspicious declarations of main. These are *NOT* pedantic warnings, they are plain old warnings, which are desirable if warn_main has been set. My default behavior was to set -Wmain if -Wall is set, unless one has selected a freestanding environment; this may or may not be correct, but as long as there is a warn_main, it is a bug for the warnings to be under pedwarn. If anyone knows when or why this was changed, I'd like to know, because I am vaguely miffed that some code I put some real effort into (mostly because I'd never even looked at gcc internals before :) ) has been, AFAIK, gratuitously broken. If someone has a problem with -Wall implying -Wmain, the thing to do is not to break -Wmain, but to remove it from the code that handles -Wall, and presumably also to change the documentation. :) I would recommend, however, that -Wmain be implied by -Wall; it is a common, easy-to-fix, error to misdeclare main. N.B.: If reverting pedwarn to warn, *DO NOT* do this to the warning for the 3rd argument if it is (char **), this is intentionally only a pedwarn, because envp used to be The Right Thing, and is specifically documented as a common extension in C89. -s