Re: [RFC] Deprecate "implicit int" for main() in C++

2018-05-08 Thread Andreas Schwab
On Mai 08 2018, Florian Weimer wrote: > I wonder if it's currently a warning because the implicit int is used in > configure checks. Is it? At least in the GCC sources I couldn't find any occurence of main without a preceding int. Andreas. -- Andreas Schwab, SUSE Labs, sch...@suse.de GPG Key

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-05-08 Thread Jonathan Wakely
On 8 May 2018 at 12:35, Florian Weimer wrote: > On 04/25/2018 04:40 PM, Jonathan Wakely wrote: >> >> More concretely, deprecating it for a few releases would allow us to >> apply the attached patch at some point in the future, so that instead >> of: >> >> rt.c:1:6: warning: ISO C++ forbids declarat

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-05-08 Thread Florian Weimer
On 04/25/2018 04:40 PM, Jonathan Wakely wrote: More concretely, deprecating it for a few releases would allow us to apply the attached patch at some point in the future, so that instead of: rt.c:1:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] main() { return 0;

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jonathan Wakely
On 25/04/18 13:13 -0400, Nathan Sidwell wrote: On 04/25/2018 12:45 PM, Jonathan Wakely wrote: @@ -15869,6 +15851,12 @@ finish_function (bool inline_p)     {   warning (OPT_Wreturn_type,   "no return statement in function returning non-void"); +  if (DECL_NAME (fndecl) == ass

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Nathan Sidwell
On 04/25/2018 12:45 PM, Jonathan Wakely wrote: @@ -15869,6 +15851,12 @@ finish_function (bool inline_p)     {   warning (OPT_Wreturn_type,   "no return statement in function returning non-void"); +  if (DECL_NAME (fndecl) == assign_op_identifier) IDENTIFIER_ASSIGN_OP_P (

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jonathan Wakely
On 25/04/18 12:22 -0400, David Malcolm wrote: On Wed, 2018-04-25 at 16:54 +0100, Jonathan Wakely wrote: On 25/04/18 16:30 +0100, Andrew Haley wrote: > On 04/25/2018 03:04 PM, Jonathan Wakely wrote: > > On 25/04/18 14:59 +0100, Andrew Haley wrote: > > > On 04/25/2018 02:56 PM, Jason Merrill wrote

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread David Malcolm
On Wed, 2018-04-25 at 16:54 +0100, Jonathan Wakely wrote: > On 25/04/18 16:30 +0100, Andrew Haley wrote: > > On 04/25/2018 03:04 PM, Jonathan Wakely wrote: > > > On 25/04/18 14:59 +0100, Andrew Haley wrote: > > > > On 04/25/2018 02:56 PM, Jason Merrill wrote: > > > > > The warning by default seems

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jonathan Wakely
On 25/04/18 16:30 +0100, Andrew Haley wrote: On 04/25/2018 03:04 PM, Jonathan Wakely wrote: On 25/04/18 14:59 +0100, Andrew Haley wrote: On 04/25/2018 02:56 PM, Jason Merrill wrote: The warning by default seems sufficient to me. Yes. We've been bitten by this a few times, with mysterious cr

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jason Merrill
On Wed, Apr 25, 2018 at 10:40 AM, Jonathan Wakely wrote: > On 25/04/18 14:53 +0100, Andrew Haley wrote: >> >> On 04/25/2018 01:23 PM, Jonathan Wakely wrote: >> >>> We enabled -Wreturn-type by default in GCC 8, so code using the >>> extension will get warnings even without -Wall now. Users might wa

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Andrew Haley
On 04/25/2018 03:04 PM, Jonathan Wakely wrote: > On 25/04/18 14:59 +0100, Andrew Haley wrote: >> On 04/25/2018 02:56 PM, Jason Merrill wrote: >>> The warning by default seems sufficient to me. >> >> Yes. We've been bitten by this a few times, with mysterious crashes. >> I'm not sure it even makes

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jonathan Wakely
On 25/04/18 14:53 +0100, Andrew Haley wrote: On 04/25/2018 01:23 PM, Jonathan Wakely wrote: We enabled -Wreturn-type by default in GCC 8, so code using the extension will get warnings even without -Wall now. Users might want to use -Werror=return-type to ensure they aren't bitten by the new opt

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jonathan Wakely
On 25/04/18 14:59 +0100, Andrew Haley wrote: On 04/25/2018 02:56 PM, Jason Merrill wrote: The warning by default seems sufficient to me. Yes. We've been bitten by this a few times, with mysterious crashes. I'm not sure it even makes sense only to be a warning, but I guess that's up to the C++

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Andrew Haley
On 04/25/2018 02:56 PM, Jason Merrill wrote: > The warning by default seems sufficient to me. Yes. We've been bitten by this a few times, with mysterious crashes. I'm not sure it even makes sense only to be a warning, but I guess that's up to the C++ TC. -- Andrew Haley Java Platform Lead Engin

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jason Merrill
On Wed, Apr 25, 2018 at 9:53 AM, Andrew Haley wrote: > On 04/25/2018 01:23 PM, Jonathan Wakely wrote: > >> We enabled -Wreturn-type by default in GCC 8, so code using the >> extension will get warnings even without -Wall now. Users might want >> to use -Werror=return-type to ensure they aren't bit

Re: [RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Andrew Haley
On 04/25/2018 01:23 PM, Jonathan Wakely wrote: > We enabled -Wreturn-type by default in GCC 8, so code using the > extension will get warnings even without -Wall now. Users might want > to use -Werror=return-type to ensure they aren't bitten by the new > optimizations that assume control never rea

[RFC] Deprecate "implicit int" for main() in C++

2018-04-25 Thread Jonathan Wakely
G++ allows the 'main' function to be declared without a return type: $ gcc-8 -x c++ - <<< 'main() { }' :1:6: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] We enabled -Wreturn-type by default in GCC 8, so code using the extension will get warnings even without -Wall