In testing my patch for bug 83871 I tried to verify that DECL_DISREGARD_INLINE_LIMITS() is being handled as expected by duplicate_decls(). I found out that even though the C and C++ front ends try to handle the limits the -finline-limit option itself is not recognized by either attribute optimize or #pragma GCC optimize. Debugging the code shows that the warning is issued by parse_optimize_options() in response to options that aren't tagged as optimization options. Sure enough, common.opt doesn't specify Optimization for the option: finline-limit- Common RejectNegative Joined Alias(finline-limit=) finline-limit= Common RejectNegative Joined UInteger -finline-limit=<number> Limit the size of inlined functions to <number>. $ cat b.c && gcc -O1 -S -Wall -Wextra -finline-limit=16 b.c #pragma GCC optimize ("inline-functions") void f0 (void); #pragma GCC optimize ("align-loops=32") void f1 (void); #pragma GCC optimize ("inline-limit=32") void f2 (void); void __attribute__ ((optimize ("inline-functions"))) f3(void); void __attribute__ ((optimize ("inline-limit=100"))) f4 (void); b.c:9:9: warning: bad option ‘-finline-limit=32’ to pragma ‘optimize’ [-Wpragmas] #pragma GCC optimize ("inline-limit=32") ^~~ b.c:11:1: warning: bad option ‘-finline-limit=32’ to attribute ‘optimize’ [-Wattributes] void f2 (void); ^~~~ b.c:14:1: warning: bad option ‘-finline-limit=32’ to attribute ‘optimize’ [-Wattributes] f3(void); ^~ b.c:17:1: warning: bad option ‘-finline-limit=32’ to attribute ‘optimize’ [-Wattributes] f4 (void); ^~ b.c:17:1: warning: bad option ‘-finline-limit=100’ to attribute ‘optimize’ [-Wattributes]
-finline-limit is a deprecated way to affect inlining, please don't expose it further.
(In reply to Richard Biener from comment #1) > -finline-limit is a deprecated way to affect inlining, please don't expose > it further. Then what about printing warning that we use for options that are deprecated?
I didn't know the option was deprecated (the manual doesn't mention it). I agree with Martin's suggestion to add a deprecation message for its uses (along with a note to the manual). Let me take care of it.
Note this is an option having IPA effect so it doesn't make sense to specify it on a per-function level. Thus INVALID. That is, the effect is setting some --params but their values are always global and not per function. So it's more an implementation "defect", some of the inliner parameters might make sense to constrain on a per-function level.
(In reply to Richard Biener from comment #4) > Note this is an option having IPA effect so it doesn't make sense to specify > it on a per-function level. Thus INVALID. > > That is, the effect is setting some --params but their values are always > global and not per function. So it's more an implementation "defect", some > of the > inliner parameters might make sense to constrain on a per-function level. And do you Richi agree with option obsoleting?
I disagree with resolving this report as invalid. If the option is deprecated at a minimum the manual, if not GCC itself, should say so. Otheriwse, if it isn't deprecated but cannot be made to work in attribute/#pragma, the manual should explain that and, ideally, GCC should mention that in the text of the warning it prints. Let me prepare a patch with one of these solutions.
I'm no longer working on this.