From c23dbaebdde77f5cca9f63f4f5f9096a17152113 Mon Sep 17 00:00:00 2001
From: Martin Nilsson <mani@lysator.liu.se>
Date: Sat, 28 Jun 2008 17:07:33 +0200
Subject: [PATCH] Warn for unknown #pragma directives.

Rev: src/lexer.h:1.80
Rev: src/testsuite.in:1.832
---
 src/lexer.h      | 6 +++++-
 src/testsuite.in | 6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/lexer.h b/src/lexer.h
index a4fa30f5b8..c1de82d4f5 100644
--- a/src/lexer.h
+++ b/src/lexer.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: lexer.h,v 1.79 2008/06/28 14:44:16 nilsson Exp $
+|| $Id: lexer.h,v 1.80 2008/06/28 15:07:33 nilsson Exp $
 */
 
 /*
@@ -740,6 +740,10 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval)
 	  {
 	    lex->pragmas &= ~ID_NO_DEPRECATION_WARNINGS;
 	  }
+          else
+          {
+            yywarning("Unknown #pragma directive.");
+          }
 	  break;
 	}
 
diff --git a/src/testsuite.in b/src/testsuite.in
index 658f80c00c..a7d229785c 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -1,5 +1,5 @@
 START_MARKER
-test_true([["$Id: testsuite.in,v 1.831 2008/06/28 14:44:16 nilsson Exp $"]]);
+test_true([["$Id: testsuite.in,v 1.832 2008/06/28 15:07:33 nilsson Exp $"]]);
 
 // This triggered a bug only if run sufficiently early.
 test_compile_any([[#pike 7.2]])
@@ -9069,10 +9069,10 @@ return 0;
 
 // #pragma
 // FIXME: add tests for real pragmas
-test_any([[
+test_compile_warning([[
 #pragma whatever
 return 1;
-]],1)
+]])
 
 test_compile_warning([[
 class A {
-- 
GitLab