diff mbox

[PR,middle-end/71373] Document missing OMP_CLAUSE_* in gcc/tree-nested.c

Message ID 874m8xqh5w.fsf@hertz.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge June 13, 2016, 2:47 p.m. UTC
Hi!

On Mon, 13 Jun 2016 16:43:25 +0200, Thomas Schwinge <thomas@codesourcery.com> wrote:
> On Wed, 01 Jun 2016 17:06:42 +0200, Thomas Schwinge <thomas@codesourcery.com> wrote:
> > Here are the OpenACC bits of <http://gcc.gnu.org/PR71373>.
> 
> In the PR, Jakub clarified that all the missing other OMP_CLAUSE_* are in
> fact all unreachable here.  [...]
> 
> The "anything else" default case in fact now is just the non-clause
> OMP_CLAUSE_ERROR, so when adding a case for that one, we could then
> remove the default case, and thus get a compiler warning when new clauses
> are added in the future, without handling them here.  That makes sense to
> me (would have made apparent much earlier the original problem of missing
> handling for certain OMP_CLAUSE_*), but based on feedback received, it
> feels as if I'm the only supporter of such "defensive" programming
> paradigms?

That is, something like that:



Grüße
 Thomas
diff mbox

Patch

--- gcc/tree-nested.c
+++ gcc/tree-nested.c
@@ -1225,8 +1225,9 @@  convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE__LOOPTEMP_:
 	case OMP_CLAUSE__SIMDUID_:
 	case OMP_CLAUSE__GRIDDIM_:
-	  /* Anything else.  */
-	default:
+	  /* This non-clause should never be seen outside of the front
+	     ends.  */
+	case OMP_CLAUSE_ERROR:
 	  gcc_unreachable ();
 	}
     }
@@ -1933,8 +1934,9 @@  convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi)
 	case OMP_CLAUSE__LOOPTEMP_:
 	case OMP_CLAUSE__SIMDUID_:
 	case OMP_CLAUSE__GRIDDIM_:
-	  /* Anything else.  */
-	default:
+	  /* This non-clause should never be seen outside of the front
+	     ends.  */
+	case OMP_CLAUSE_ERROR:
 	  gcc_unreachable ();
 	}
     }