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]

PR 43195 #pragma once and -H


Bootstrapped and regression tested on x86_64-linux-gnu.

OK for 4.5?

2010-02-28  Manuel López-Ibáñez <manu@gcc.gnu.org>

libcpp/
	* files.c (report_missing_guard): Test for #pragma once.
testsuite/
	* gcc.dg/cpp/pr43195.c: New.
	* gcc.dg/cpp/pr43195.h: New.
Index: gcc/testsuite/gcc.dg/cpp/pr43195.c
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr43195.c	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr43195.c	(revision 0)
@@ -0,0 +1,6 @@
+/* PR preprocessor/43195 */
+/* { dg-do preprocess } */
+/* { dg-options "-H" } */
+/* { dg-message "pr43195\.h\n" "" { target *-*-* } 0 } */
+#include "pr43195.h"
+
Index: gcc/testsuite/gcc.dg/cpp/pr43195.h
===================================================================
--- gcc/testsuite/gcc.dg/cpp/pr43195.h	(revision 0)
+++ gcc/testsuite/gcc.dg/cpp/pr43195.h	(revision 0)
@@ -0,0 +1 @@
+#pragma once
Index: libcpp/files.c
===================================================================
--- libcpp/files.c	(revision 157099)
+++ libcpp/files.c	(working copy)
@@ -1259,11 +1259,12 @@ report_missing_guard (void **slot, void 
   if (entry->start_dir != NULL)
     {
       _cpp_file *file = entry->u.file;
 
       /* We don't want MI guard advice for the main file.  */
-      if (file->cmacro == NULL && file->stack_count == 1 && !file->main_file)
+      if (!file->once_only && file->cmacro == NULL
+	  && file->stack_count == 1 && !file->main_file)
 	{
 	  if (data->paths == NULL)
 	    {
 	      data->paths = XCNEWVEC (const char *, data->count);
 	      data->count = 0;

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