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: [Gomp] openmp syntax check - trial approach


Jacob Weismann Poulsen wrote:

The patch allows one to do syntax checking on all the samples in the
appendix of the openMP specification version 2.0 BUT it should be mentioned
that I haven't polished it nor tested it properly yet (better get some reactions first).


This is a good start. Good stuff.

I would probably keep with the convention of calling these routines c_gomp_...

Other than that, the patch looks reasonable (some suggestions below). You will need ChangeLog entries. Do you have write access to CVS?

-/* Return true when fails to find an open parenthesis. */
+/* Return false when fails to find new-line. */
s/when fails/when it fails/

-      error ("Expected an open parenthesis.");
-      return true;
+      error ("Expected a newline in handling of '#pragma omp'.");
>
The convention is not to end error messages with '.'


+  while (token == CPP_NAME)
+    {
+      if (name_t == NULL_TREE
+	  || (name_decl = lookup_name (name_t)) == NULL_TREE
+	  || TREE_CODE (name_decl) != VAR_DECL)
>
Maybe DECL_P?  Are function arguments valid here?

+	{
+	  inform ("Expected a variable.");
+	}
+      /* else TODO: mark that variable as private...  */
+      token = c_lex (&name_t);
+      if (token == CPP_COMMA)
+	{
+	  token = c_lex (&name_t);
+	  if (token == CPP_NAME)
+	    {
+	      if (name_t == NULL_TREE
+		  || (name_decl = lookup_name (name_t)) == NULL_TREE
+		  || TREE_CODE (name_decl) != VAR_DECL)
>
Likewise.  This predicate could be factored.

+/* Parses the set of possible OMP clauses */
+
+static void
+gomp_handle_clause (enum omp_clause clause)
>
Document the argument.  Mention it in capitals.

+	  const char *name = IDENTIFIER_POINTER (x);
+	  if (!strcmp (name, "nowait"))
+	    {
+	    }
+
call gomp_nyi here?

+		      const char *name = IDENTIFIER_POINTER (x);
+		      if (!strcmp (name, "none"))
+			{
+			}
>
Likewise.

+		      else if (!strcmp (name, "shared"))
+			{
+			}
>
Likewise.

+	  else if (!strcmp (name, "reduction"))
+	    {
+	      gomp_handle_reduction ();
+	    }
>
No need to use braces when the body is a single line. But that's a matter of personal preference.


+/* Parse a parallel-directive:
+ * "#pragma omp parallel [par_clause[ [, par_clause] ... ]] new-line". */
void
-c_gomp_parallel_pragma (cpp_reader *pfile)
+c_gomp_parallel_pragma (cpp_reader * pfile)

Document arguments.



-c_gomp_flush_pragma (cpp_reader *pfile ATTRIBUTE_UNUSED)
+c_gomp_flush_pragma (cpp_reader * pfile ATTRIBUTE_UNUSED)
>
No space after '*'.



Diego.


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