This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] PR c++/90590 Suppress warning for enumeration value not handled in switch warning


On Fri, Jul 12, 2019 at 02:34:37PM -0400, Matthew Beliveau wrote:
> @@ -1628,6 +1629,16 @@ c_do_switch_warnings (splay_tree cases, location_t switch_location,
>        if (cond && tree_int_cst_compare (cond, value))
>  	continue;
>  
> +      /* If the enumerator is defined in a system header and uses a reserved
> +	 name, then we continue to avoid throwing a warning.  */
> +      location_t loc = DECL_SOURCE_LOCATION
> +	    (TYPE_STUB_DECL (TYPE_MAIN_VARIANT (type)));

As I mentioned before, I wonder if we can get away without the
TYPE_MAIN_VARIANT here.

> +      if (in_system_header_at (loc)
> +	  && name_reserved_for_implementation_p
> +	      (IDENTIFIER_POINTER (TREE_PURPOSE (chain))))
> +	continue;
> +
> +

Please drop one newline here.

Marek


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]