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]

Minor C/C++ front end cleanups


I found these while I was going back over some old experimental work.
Bootstrapped amd64-linux and committed as obvious.  (Thanks to Andrew
Pinski for suggesting use of c-pragma.h, which I had forgotten
existed.)

yydebug has been a write-only variable since the introduction of the
new C and C++ parsers.

zw

	* c-opts.c (c_common_parse_file): Unconditionally give a warning,
	suitable for the language, if set_yydebug is true.
	* c-pragma.h: Define enum pragma_omp_clause here.  Don't define
	YYDEBUG or declare yydebug.
	* c-parser.c (yydebug, enum pragma_omp_clause): Delete.
	* cp/parser.c: Likewise.

==================================================================
--- c-opts.c	(revision 119761)
+++ c-opts.c	(local)
@@ -1163,14 +1163,26 @@ c_common_parse_file (int set_yydebug)
{
  unsigned int i;

-  /* Enable parser debugging, if requested and we can.  If requested
-     and we can't, notify the user.  */
-#if YYDEBUG != 0
-  yydebug = set_yydebug;
-#else
  if (set_yydebug)
-    warning (0, "YYDEBUG was not defined at build time, -dy ignored");
-#endif
+    switch (c_language)
+      {
+      case clk_c:
+	warning(0, "The C parser does not support -dy, option ignored");
+	break;
+      case clk_objc:
+	warning(0,
+		"The Objective-C parser does not support -dy, option ignored");
+	break;
+      case clk_cxx:
+	warning(0, "The C++ parser does not support -dy, option ignored");
+	break;
+      case clk_objcxx:
+	warning(0,
+	    "The Objective-C++ parser does not support -dy, option ignored");
+	break;
+      default:
+	gcc_unreachable ();
+    }

  i = 0;
  for (;;)
==================================================================
--- c-parser.c	(revision 119761)
+++ c-parser.c	(local)
@@ -59,10 +59,6 @@ Software Foundation, 51 Franklin Street,
#include "cgraph.h"


-/* Miscellaneous data and functions needed for the parser.  */
-
-int yydebug;
-
/* Objective-C specific parser/lexer information.  */

static int objc_pq_context = 0;
@@ -200,26 +196,6 @@ static const struct resword reswords[] =
};
#define N_reswords (sizeof reswords / sizeof (struct resword))

-/* All OpenMP clauses.  OpenMP 2.5.  */
-typedef enum pragma_omp_clause {
-  PRAGMA_OMP_CLAUSE_NONE = 0,
-
-  PRAGMA_OMP_CLAUSE_COPYIN,
-  PRAGMA_OMP_CLAUSE_COPYPRIVATE,
-  PRAGMA_OMP_CLAUSE_DEFAULT,
-  PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
-  PRAGMA_OMP_CLAUSE_IF,
-  PRAGMA_OMP_CLAUSE_LASTPRIVATE,
-  PRAGMA_OMP_CLAUSE_NOWAIT,
-  PRAGMA_OMP_CLAUSE_NUM_THREADS,
-  PRAGMA_OMP_CLAUSE_ORDERED,
-  PRAGMA_OMP_CLAUSE_PRIVATE,
-  PRAGMA_OMP_CLAUSE_REDUCTION,
-  PRAGMA_OMP_CLAUSE_SCHEDULE,
-  PRAGMA_OMP_CLAUSE_SHARED
-} pragma_omp_clause;
-
-
/* Initialization routine for this file.  */

void
==================================================================
--- c-pragma.h	(revision 119761)
+++ c-pragma.h	(local)
@@ -49,9 +49,26 @@ typedef enum pragma_kind {
  PRAGMA_FIRST_EXTERNAL
} pragma_kind;

-/* Cause the `yydebug' variable to be defined.  */
-#define YYDEBUG 1
-extern int yydebug;
+
+/* All clauses defined by OpenMP 2.5.
+   Used internally by both C and C++ parsers.  */
+typedef enum pragma_omp_clause {
+  PRAGMA_OMP_CLAUSE_NONE = 0,
+
+  PRAGMA_OMP_CLAUSE_COPYIN,
+  PRAGMA_OMP_CLAUSE_COPYPRIVATE,
+  PRAGMA_OMP_CLAUSE_DEFAULT,
+  PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
+  PRAGMA_OMP_CLAUSE_IF,
+  PRAGMA_OMP_CLAUSE_LASTPRIVATE,
+  PRAGMA_OMP_CLAUSE_NOWAIT,
+  PRAGMA_OMP_CLAUSE_NUM_THREADS,
+  PRAGMA_OMP_CLAUSE_ORDERED,
+  PRAGMA_OMP_CLAUSE_PRIVATE,
+  PRAGMA_OMP_CLAUSE_REDUCTION,
+  PRAGMA_OMP_CLAUSE_SCHEDULE,
+  PRAGMA_OMP_CLAUSE_SHARED
+} pragma_omp_clause;

extern struct cpp_reader* parse_in;

==================================================================
--- cp/parser.c	(revision 119761)
+++ cp/parser.c	(local)
@@ -18073,25 +18073,6 @@ cp_parser_objc_statement (cp_parser * pa

/* OpenMP 2.5 parsing routines.  */

-/* All OpenMP clauses.  OpenMP 2.5.  */
-typedef enum pragma_omp_clause {
-  PRAGMA_OMP_CLAUSE_NONE = 0,
-
-  PRAGMA_OMP_CLAUSE_COPYIN,
-  PRAGMA_OMP_CLAUSE_COPYPRIVATE,
-  PRAGMA_OMP_CLAUSE_DEFAULT,
-  PRAGMA_OMP_CLAUSE_FIRSTPRIVATE,
-  PRAGMA_OMP_CLAUSE_IF,
-  PRAGMA_OMP_CLAUSE_LASTPRIVATE,
-  PRAGMA_OMP_CLAUSE_NOWAIT,
-  PRAGMA_OMP_CLAUSE_NUM_THREADS,
-  PRAGMA_OMP_CLAUSE_ORDERED,
-  PRAGMA_OMP_CLAUSE_PRIVATE,
-  PRAGMA_OMP_CLAUSE_REDUCTION,
-  PRAGMA_OMP_CLAUSE_SCHEDULE,
-  PRAGMA_OMP_CLAUSE_SHARED
-} pragma_omp_clause;
-
/* Returns name of the next clause.
   If the clause is not recognized PRAGMA_OMP_CLAUSE_NONE is returned and
   the token is not consumed.  Otherwise appropriate pragma_omp_clause is
@@ -19441,8 +19422,4 @@ c_parse_file (void)
  the_parser = NULL;
}

-/* This variable must be provided by every front end.  */
-
-int yydebug;
-
#include "gt-cp-parser.h"

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