c-family: Use -Wdiscarded-qualifiers for ignored qualifiers in __atomic_*

Message ID 87edfk6dr6.fsf@oldenburg.str.redhat.com
State Accepted
Headers
Series c-family: Use -Wdiscarded-qualifiers for ignored qualifiers in __atomic_* |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Florian Weimer Dec. 17, 2023, 3:38 p.m. UTC
  This matches other compiler diagnostics.  No test updates are needed
because c-c++-common/pr95378.c does not match a specific -W option.

Fixes commit d2384b7b24f8557b66f6958a05ea99ff4307e75c ("c-family:
check qualifiers of arguments to __atomic built-ins (PR 95378)").

gcc/c-family/

	PR c/113050
	* c-common.cc (get_atomic_generic_size): Use
	OPT_Wdiscarded_qualifiers instead of
	OPT_Wincompatible_pointer_types.

---

Jonathan, I assume this was just an oversight in your patch, and there
is no fundamental reason to use -Wincompatible-pointer-types here?

Thanks,
Florian

 gcc/c-family/c-common.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: da70c5b17123b7c81155ef03fb4591b71a681344
  

Comments

Jonathan Wakely Dec. 18, 2023, 12:02 a.m. UTC | #1
On Sun, 17 Dec 2023 at 15:38, Florian Weimer <fweimer@redhat.com> wrote:
>
> This matches other compiler diagnostics.  No test updates are needed
> because c-c++-common/pr95378.c does not match a specific -W option.
>
> Fixes commit d2384b7b24f8557b66f6958a05ea99ff4307e75c ("c-family:
> check qualifiers of arguments to __atomic built-ins (PR 95378)").
>
> gcc/c-family/
>
>         PR c/113050
>         * c-common.cc (get_atomic_generic_size): Use
>         OPT_Wdiscarded_qualifiers instead of
>         OPT_Wincompatible_pointer_types.
>
> ---
>
> Jonathan, I assume this was just an oversight in your patch, and there
> is no fundamental reason to use -Wincompatible-pointer-types here?

You are correct. I think I forgot about -Wdiscarded-qualifiers at the time.
  
Joseph Myers Dec. 18, 2023, 6:22 p.m. UTC | #2
On Sun, 17 Dec 2023, Florian Weimer wrote:

> This matches other compiler diagnostics.  No test updates are needed
> because c-c++-common/pr95378.c does not match a specific -W option.
> 
> Fixes commit d2384b7b24f8557b66f6958a05ea99ff4307e75c ("c-family:
> check qualifiers of arguments to __atomic built-ins (PR 95378)").
> 
> gcc/c-family/
> 
> 	PR c/113050
> 	* c-common.cc (get_atomic_generic_size): Use
> 	OPT_Wdiscarded_qualifiers instead of
> 	OPT_Wincompatible_pointer_types.

OK.
  

Patch

diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 0f1de44a348..6ea727f446f 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -7637,7 +7637,7 @@  get_atomic_generic_size (location_t loc, tree function,
 		return 0;
 	      }
 	    else
-	      pedwarn (loc, OPT_Wincompatible_pointer_types, "argument %d "
+	      pedwarn (loc, OPT_Wdiscarded_qualifiers, "argument %d "
 		       "of %qE discards %<const%> qualifier", x + 1,
 		       function);
 	  }
@@ -7651,7 +7651,7 @@  get_atomic_generic_size (location_t loc, tree function,
 		return 0;
 	      }
 	    else
-	      pedwarn (loc, OPT_Wincompatible_pointer_types, "argument %d "
+	      pedwarn (loc, OPT_Wdiscarded_qualifiers, "argument %d "
 		       "of %qE discards %<volatile%> qualifier", x + 1,
 		       function);
 	  }