public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, PR 61340] Add default label to two switches on enum ipa_ref_use
@ 2014-06-03 16:01 Martin Jambor
  2014-06-03 19:13 ` Jan Hubicka
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2014-06-03 16:01 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

Hi,

in PR 61340 it has been reported that clang warns about unhandeld enum
values in a switch (gcc does not, I guess I'll open a new PR for
that).

Fixed thusly by adding a default label with a gcc_unreachable() in
both.  The potentially unhandled enum value in both cases is
IPA_REF_ALIAS which we cannot encounter because

1) in ipa-pure-const.c we are not processing aliases and

2) in ipa-reference.c we analyze references of a function to a
   variable and that cannot be an alias.

OK for trunk?

Thanks,

Martin


2014-06-03  Martin Jambor  <mjambor@suse.cz>

	PR ipa/61340
	* ipa-pure-const.c (propagate_pure_const): Add unreachable default
	handler for switch on an ipa_ref_use enum.
	* ipa-reference.c (analyze_function): Likewise.

diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 0ebfe5d..b9a3d3e 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1286,6 +1286,8 @@ propagate_pure_const (void)
 		  break;
 		case IPA_REF_ADDR:
 		  break;
+		default:
+		  gcc_unreachable ();
 		}
 	      better_state (&ref_state, &ref_looping,
 			    w_l->state_previously_known,
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
index ebff60c..bc58cfa 100644
--- a/gcc/ipa-reference.c
+++ b/gcc/ipa-reference.c
@@ -483,6 +483,8 @@ analyze_function (struct cgraph_node *fn)
 	  break;
 	case IPA_REF_ADDR:
 	  break;
+	default:
+	  gcc_unreachable ();
 	}
     }
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH, PR 61340] Add default label to two switches on enum ipa_ref_use
  2014-06-03 16:01 [PATCH, PR 61340] Add default label to two switches on enum ipa_ref_use Martin Jambor
@ 2014-06-03 19:13 ` Jan Hubicka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2014-06-03 19:13 UTC (permalink / raw)
  To: GCC Patches, Jan Hubicka

> Hi,
> 
> in PR 61340 it has been reported that clang warns about unhandeld enum
> values in a switch (gcc does not, I guess I'll open a new PR for
> that).
> 
> Fixed thusly by adding a default label with a gcc_unreachable() in
> both.  The potentially unhandled enum value in both cases is
> IPA_REF_ALIAS which we cannot encounter because
> 
> 1) in ipa-pure-const.c we are not processing aliases and
> 
> 2) in ipa-reference.c we analyze references of a function to a
>    variable and that cannot be an alias.
> 
> OK for trunk?

OK,
thanks!
Honza
> 
> Thanks,
> 
> Martin
> 
> 
> 2014-06-03  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR ipa/61340
> 	* ipa-pure-const.c (propagate_pure_const): Add unreachable default
> 	handler for switch on an ipa_ref_use enum.
> 	* ipa-reference.c (analyze_function): Likewise.
> 
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index 0ebfe5d..b9a3d3e 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1286,6 +1286,8 @@ propagate_pure_const (void)
>  		  break;
>  		case IPA_REF_ADDR:
>  		  break;
> +		default:
> +		  gcc_unreachable ();
>  		}
>  	      better_state (&ref_state, &ref_looping,
>  			    w_l->state_previously_known,
> diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c
> index ebff60c..bc58cfa 100644
> --- a/gcc/ipa-reference.c
> +++ b/gcc/ipa-reference.c
> @@ -483,6 +483,8 @@ analyze_function (struct cgraph_node *fn)
>  	  break;
>  	case IPA_REF_ADDR:
>  	  break;
> +	default:
> +	  gcc_unreachable ();
>  	}
>      }
>  
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-03 19:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-03 16:01 [PATCH, PR 61340] Add default label to two switches on enum ipa_ref_use Martin Jambor
2014-06-03 19:13 ` Jan Hubicka

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).