[Bug c++/83798] New: Enhancement to Wmain warnings
denis.campredon at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 11 13:19:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83798
Bug ID: 83798
Summary: Enhancement to Wmain warnings
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: denis.campredon at gmail dot com
Target Milestone: ---
Compiled with g++ the following code produces some rather confusing warnings:
---------------
int main(short s, void** t, int** u, int** v) {}
---------------
1 : <source>:1:5: warning: first argument of 'int main(short int, void**,
int**, int**)' should be 'int' [-Wmain]
int main(short s, void** t, int** u, int** v) {}
^~~~
1 : <source>:1:5: warning: second argument of 'int main(short int, void**,
int**, int**)' should be 'char **' [-Wmain]
1 : <source>:1:5: warning: third argument of 'int main(short int, void**,
int**, int**)' should probably be 'char **' [-Wmain]
1 : <source>:1:5: warning: 'int main(short int, void**, int**, int**)' takes
only zero or two arguments [-Wmain]
---------------
In the first three warnings, just '::main' should be displayed, like when
compiled with gcc, instead of the full signature.
For the fourth one, we can see that gcc also accepts three arguments in main,
for the env, not only 0 or 2.
More information about the Gcc-bugs
mailing list