* [PATCH] Fix -Wattribute-alias option
@ 2019-01-19 10:06 Bernd Edlinger
2019-01-21 15:42 ` Arnd Bergmann
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Bernd Edlinger @ 2019-01-19 10:06 UTC (permalink / raw)
To: gcc-patches, Jeff Law, Martin Sebor, Arnd Bergmann
[-- Attachment #1: Type: text/plain, Size: 827 bytes --]
Hi,
the command line option -Wattribute-alias (w/o the "=1") is currently broken,
and only -Wno-attribute-alias is still working, but what is worse, is that
the #pragma GCC diagnostic fails to recognize the string "-Wattribute-alias",
as it used to do in gcc-8, which breaks the linux warning suppression macro
because it relies on a _Pragma to work.
Fixed by declaring -Wattribute-alias as an alias to -Wattribute-alias=1
and the negated form as an alias to -Wattribute-alias=0.
Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
Is it OK for trunk?
Additionally I looked into the linux 4.20 build, got a couple "-Wmissing-attributes"
which seem easy to fix (by adding the cold attribute) and quite a lot
"-Waddress-of-packed-member" warnings, which I don't know how to fix properly.
Thanks
Bernd.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-fix-wattribute-alias.diff --]
[-- Type: text/x-patch; name="patch-fix-wattribute-alias.diff", Size: 2026 bytes --]
2019-01-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
* common.opt (-Wattribute-alias): Remove "no-" from name.
Make -Wattribute-alias command line option and
#pragma GCC diagnostic ignore "-Wattribute-alias" work again.
testsuite:
2019-01-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
* gcc.dg/Wattribute-alias.c: Add test for #pragma GCC diagnostic ignore
"-Wattribute-alias".
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 268084)
+++ gcc/common.opt (working copy)
@@ -550,14 +550,14 @@ Wattributes
Common Var(warn_attributes) Init(1) Warning
Warn about inappropriate attribute usage.
+Wattribute-alias
+Common Alias(Wattribute_alias=, 1, 0) Warning
+Warn about type safety and similar errors and mismatches in attribute alias and related.
+
Wattribute-alias=
Common Joined RejectNegative UInteger Var(warn_attribute_alias) Init(1) Warning IntegerRange(0, 2)
Warn about type safety and similar errors and mismatches in attribute alias and related.
-Wno-attribute-alias
-Common Alias(Wattribute_alias=, 0, 0) Warning
-Disable -Wattribute-alias.
-
Wcannot-profile
Common Var(warn_cannot_profile) Init(1) Warning
Warn when profiling instrumentation was requested, but could not be applied to
Index: gcc/testsuite/gcc.dg/Wattribute-alias.c
===================================================================
--- gcc/testsuite/gcc.dg/Wattribute-alias.c (revision 268084)
+++ gcc/testsuite/gcc.dg/Wattribute-alias.c (working copy)
@@ -14,6 +14,13 @@ ATTR (alias ("target_no_nothrow"), nothrow) void
alias_nothrow (void); /* { dg-warning ".alias_nothrow. specifies more restrictive attribute than its target .target_no_nothrow.: .nothrow." } */
+#pragma GCC diagnostic push "-Wattribute-alias"
+#pragma GCC diagnostic ignored "-Wattribute-alias"
+ATTR (alias ("target_no_nothrow"), nothrow) void
+alias_nothrow_ignored (void);
+#pragma GCC diagnostic pop "-Wattribute-alias"
+
+
ATTR (pure) int
alias_pure (void);
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix -Wattribute-alias option
2019-01-19 10:06 [PATCH] Fix -Wattribute-alias option Bernd Edlinger
@ 2019-01-21 15:42 ` Arnd Bergmann
2019-01-21 15:55 ` Bernd Edlinger
2019-01-27 16:54 ` [PING] " Bernd Edlinger
2019-01-28 7:50 ` Jakub Jelinek
2 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2019-01-21 15:42 UTC (permalink / raw)
To: Bernd Edlinger; +Cc: gcc-patches, Jeff Law, Martin Sebor
On Sat, Jan 19, 2019 at 11:06 AM Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
>
> Hi,
>
> the command line option -Wattribute-alias (w/o the "=1") is currently broken,
> and only -Wno-attribute-alias is still working, but what is worse, is that
> the #pragma GCC diagnostic fails to recognize the string "-Wattribute-alias",
> as it used to do in gcc-8, which breaks the linux warning suppression macro
> because it relies on a _Pragma to work.
I'm surprised by this, since I have not seen the warning in a while. I am
however still using gcc-8.1 locally. Did this change later during the
gcc-8 branch?
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix -Wattribute-alias option
2019-01-21 15:42 ` Arnd Bergmann
@ 2019-01-21 15:55 ` Bernd Edlinger
2019-01-21 15:58 ` Arnd Bergmann
2019-01-21 16:32 ` Martin Sebor
0 siblings, 2 replies; 7+ messages in thread
From: Bernd Edlinger @ 2019-01-21 15:55 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: gcc-patches, Jeff Law, Martin Sebor
On 1/21/19 4:42 PM, Arnd Bergmann wrote:
> On Sat, Jan 19, 2019 at 11:06 AM Bernd Edlinger
> <bernd.edlinger@hotmail.de> wrote:
>>
>> Hi,
>>
>> the command line option -Wattribute-alias (w/o the "=1") is currently broken,
>> and only -Wno-attribute-alias is still working, but what is worse, is that
>> the #pragma GCC diagnostic fails to recognize the string "-Wattribute-alias",
>> as it used to do in gcc-8, which breaks the linux warning suppression macro
>> because it relies on a _Pragma to work.
>
> I'm surprised by this, since I have not seen the warning in a while. I am
> however still using gcc-8.1 locally. Did this change later during the
> gcc-8 branch?
>
Yes.
The -Wattribute-alias was split up in -Wattribute-alias=1 an -Wattribute-alias=2
and -Wmissing-attributes on gcc-trunk (but not in the gcc-8 branch as far as I know).
The -Wmissing-attribute also triggers in include/linux/module.h but for that one,
I will probably have to send a patch to the linux-kernel list.
$ svn log -r265980
------------------------------------------------------------------------
r265980 | msebor | 2018-11-09 18:32:52 +0100 (Fri, 09 Nov 2018) | 39 lines
PR middle-end/81824 - Warn for missing attributes with function aliases
gcc/c-family/ChangeLog:
PR middle-end/81824
* c-attribs.c (handle_copy_attribute): New function.
gcc/cp/ChangeLog:
PR middle-end/81824
* pt.c (warn_spec_missing_attributes): Move code to attribs.c.
Call decls_mismatched_attributes.
gcc/ChangeLog:
PR middle-end/81824
* attribs.c (has_attribute): New helper function.
(decls_mismatched_attributes, maybe_diag_alias_attributes): Same.
* attribs.h (decls_mismatched_attributes): Declare.
* cgraphunit.c (handle_alias_pairs): Call maybe_diag_alias_attributes.
(maybe_diag_incompatible_alias): Use OPT_Wattribute_alias_.
* common.opt (-Wattribute-alias): Take an argument.
(-Wno-attribute-alias): New option.
* doc/extend.texi (Common Function Attributes): Document copy.
(Common Variable Attributes): Same.
* doc/invoke.texi (-Wmissing-attributes): Document enhancement.
(-Wattribute-alias): Document new option argument.
gcc/testsuite/ChangeLog:
PR middle-end/81824
* gcc.dg/Wattribute-alias.c: New test.
* gcc.dg/Wmissing-attributes.c: New test.
* gcc.dg/attr-copy.c: New test.
* gcc.dg/attr-copy-2.c: New test.
* gcc.dg/attr-copy-3.c: New test.
* gcc.dg/attr-copy-4.c: New test.
Bernd.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix -Wattribute-alias option
2019-01-21 15:55 ` Bernd Edlinger
@ 2019-01-21 15:58 ` Arnd Bergmann
2019-01-21 16:32 ` Martin Sebor
1 sibling, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2019-01-21 15:58 UTC (permalink / raw)
To: Bernd Edlinger; +Cc: gcc-patches, Jeff Law, Martin Sebor
On Mon, Jan 21, 2019 at 4:55 PM Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
> On 1/21/19 4:42 PM, Arnd Bergmann wrote:
> > On Sat, Jan 19, 2019 at 11:06 AM Bernd Edlinger
> > <bernd.edlinger@hotmail.de> wrote:
> >>
> >> Hi,
> >>
> >> the command line option -Wattribute-alias (w/o the "=1") is currently broken,
> >> and only -Wno-attribute-alias is still working, but what is worse, is that
> >> the #pragma GCC diagnostic fails to recognize the string "-Wattribute-alias",
> >> as it used to do in gcc-8, which breaks the linux warning suppression macro
> >> because it relies on a _Pragma to work.
> >
> > I'm surprised by this, since I have not seen the warning in a while. I am
> > however still using gcc-8.1 locally. Did this change later during the
> > gcc-8 branch?
> >
>
> Yes.
>
> The -Wattribute-alias was split up in -Wattribute-alias=1 an -Wattribute-alias=2
> and -Wmissing-attributes on gcc-trunk (but not in the gcc-8 branch as far as I know).
>
> The -Wmissing-attribute also triggers in include/linux/module.h but for that one,
> I will probably have to send a patch to the linux-kernel list.
I got it, I misread your earlier message as saying that it also
happened on gcc-8.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix -Wattribute-alias option
2019-01-21 15:55 ` Bernd Edlinger
2019-01-21 15:58 ` Arnd Bergmann
@ 2019-01-21 16:32 ` Martin Sebor
1 sibling, 0 replies; 7+ messages in thread
From: Martin Sebor @ 2019-01-21 16:32 UTC (permalink / raw)
To: Bernd Edlinger, Arnd Bergmann; +Cc: gcc-patches, Jeff Law
On 1/21/19 8:55 AM, Bernd Edlinger wrote:
>
>
> On 1/21/19 4:42 PM, Arnd Bergmann wrote:
>> On Sat, Jan 19, 2019 at 11:06 AM Bernd Edlinger
>> <bernd.edlinger@hotmail.de> wrote:
>>>
>>> Hi,
>>>
>>> the command line option -Wattribute-alias (w/o the "=1") is currently broken,
>>> and only -Wno-attribute-alias is still working, but what is worse, is that
>>> the #pragma GCC diagnostic fails to recognize the string "-Wattribute-alias",
>>> as it used to do in gcc-8, which breaks the linux warning suppression macro
>>> because it relies on a _Pragma to work.
>>
>> I'm surprised by this, since I have not seen the warning in a while. I am
>> however still using gcc-8.1 locally. Did this change later during the
>> gcc-8 branch?
>>
>
> Yes.
>
> The -Wattribute-alias was split up in -Wattribute-alias=1 an -Wattribute-alias=2
> and -Wmissing-attributes on gcc-trunk (but not in the gcc-8 branch as far as I know).
>
> The -Wmissing-attribute also triggers in include/linux/module.h but for that one,
> I will probably have to send a patch to the linux-kernel list.
Miguel Ojeda has been working with me on the kernel changes.
Martin
>
>
> $ svn log -r265980
> ------------------------------------------------------------------------
> r265980 | msebor | 2018-11-09 18:32:52 +0100 (Fri, 09 Nov 2018) | 39 lines
>
> PR middle-end/81824 - Warn for missing attributes with function aliases
>
> gcc/c-family/ChangeLog:
>
> PR middle-end/81824
> * c-attribs.c (handle_copy_attribute): New function.
>
> gcc/cp/ChangeLog:
>
> PR middle-end/81824
> * pt.c (warn_spec_missing_attributes): Move code to attribs.c.
> Call decls_mismatched_attributes.
>
> gcc/ChangeLog:
>
> PR middle-end/81824
> * attribs.c (has_attribute): New helper function.
> (decls_mismatched_attributes, maybe_diag_alias_attributes): Same.
> * attribs.h (decls_mismatched_attributes): Declare.
> * cgraphunit.c (handle_alias_pairs): Call maybe_diag_alias_attributes.
> (maybe_diag_incompatible_alias): Use OPT_Wattribute_alias_.
> * common.opt (-Wattribute-alias): Take an argument.
> (-Wno-attribute-alias): New option.
> * doc/extend.texi (Common Function Attributes): Document copy.
> (Common Variable Attributes): Same.
> * doc/invoke.texi (-Wmissing-attributes): Document enhancement.
> (-Wattribute-alias): Document new option argument.
>
> gcc/testsuite/ChangeLog:
>
> PR middle-end/81824
> * gcc.dg/Wattribute-alias.c: New test.
> * gcc.dg/Wmissing-attributes.c: New test.
> * gcc.dg/attr-copy.c: New test.
> * gcc.dg/attr-copy-2.c: New test.
> * gcc.dg/attr-copy-3.c: New test.
> * gcc.dg/attr-copy-4.c: New test.
>
>
>
> Bernd.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PING] [PATCH] Fix -Wattribute-alias option
2019-01-19 10:06 [PATCH] Fix -Wattribute-alias option Bernd Edlinger
2019-01-21 15:42 ` Arnd Bergmann
@ 2019-01-27 16:54 ` Bernd Edlinger
2019-01-28 7:50 ` Jakub Jelinek
2 siblings, 0 replies; 7+ messages in thread
From: Bernd Edlinger @ 2019-01-27 16:54 UTC (permalink / raw)
To: gcc-patches, Richard Biener, Jakub Jelinek
Hi,
I'd like to ping for this patch: https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01120.html
This patch would be needed to avoid a rather ugly workaround for the the issue
in the linux-tree.
Thanks
Bernd.
On 1/19/19 11:06 AM, Bernd Edlinger wrote:
> Hi,
>
> the command line option -Wattribute-alias (w/o the "=1") is currently broken,
> and only -Wno-attribute-alias is still working, but what is worse, is that
> the #pragma GCC diagnostic fails to recognize the string "-Wattribute-alias",
> as it used to do in gcc-8, which breaks the linux warning suppression macro
> because it relies on a _Pragma to work.
>
> Fixed by declaring -Wattribute-alias as an alias to -Wattribute-alias=1
> and the negated form as an alias to -Wattribute-alias=0.
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
>
> Additionally I looked into the linux 4.20 build, got a couple "-Wmissing-attributes"
> which seem easy to fix (by adding the cold attribute) and quite a lot
> "-Waddress-of-packed-member" warnings, which I don't know how to fix properly.
>
>
> Thanks
> Bernd.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Fix -Wattribute-alias option
2019-01-19 10:06 [PATCH] Fix -Wattribute-alias option Bernd Edlinger
2019-01-21 15:42 ` Arnd Bergmann
2019-01-27 16:54 ` [PING] " Bernd Edlinger
@ 2019-01-28 7:50 ` Jakub Jelinek
2 siblings, 0 replies; 7+ messages in thread
From: Jakub Jelinek @ 2019-01-28 7:50 UTC (permalink / raw)
To: Bernd Edlinger; +Cc: gcc-patches, Jeff Law, Martin Sebor, Arnd Bergmann
On Sat, Jan 19, 2019 at 10:06:29AM +0000, Bernd Edlinger wrote:
> 2019-01-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
>
> * common.opt (-Wattribute-alias): Remove "no-" from name.
> Make -Wattribute-alias command line option and
> #pragma GCC diagnostic ignore "-Wattribute-alias" work again.
>
> testsuite:
> 2019-01-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
>
> * gcc.dg/Wattribute-alias.c: Add test for #pragma GCC diagnostic ignore
> "-Wattribute-alias".
Ok, thanks.
Jakub
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-01-28 7:38 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-19 10:06 [PATCH] Fix -Wattribute-alias option Bernd Edlinger
2019-01-21 15:42 ` Arnd Bergmann
2019-01-21 15:55 ` Bernd Edlinger
2019-01-21 15:58 ` Arnd Bergmann
2019-01-21 16:32 ` Martin Sebor
2019-01-27 16:54 ` [PING] " Bernd Edlinger
2019-01-28 7:50 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).