aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-pragma.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@cygnus.com>1997-12-21 08:24:48 -0700
committerJeff Law <law@gcc.gnu.org>1997-12-21 08:24:48 -0700
commitd300e55140f3d2b7c72b6e2c54aa8117508a278e (patch)
tree0b8fadd5175f1003cd62fe44249ac0f84a09d3d4 /gcc/c-pragma.c
parentf9fc59e8c7d867eed481ec74433c8e582f95ce39 (diff)
downloadgcc-d300e55140f3d2b7c72b6e2c54aa8117508a278e.zip
gcc-d300e55140f3d2b7c72b6e2c54aa8117508a278e.tar.gz
gcc-d300e55140f3d2b7c72b6e2c54aa8117508a278e.tar.bz2
c-pragma.c (handle_pragma_token): Generate warning messages about unknown pragmas if warn_unknown_pragmas is set.
* c-pragma.c (handle_pragma_token): Generate warning messages about unknown pragmas if warn_unknown_pragmas is set. * c-decl.c (c_decode_option): Parse -Wunknown-pragmas command line option to set variable: warn_unknown_pragmas. From-SVN: r17168
Diffstat (limited to 'gcc/c-pragma.c')
-rw-r--r--gcc/c-pragma.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index 886c67b..87e060e 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -1,5 +1,5 @@
/* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
- Copyright (C) 1992 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1997 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -18,8 +18,8 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stdio.h>
#include "config.h"
+#include <stdio.h>
#include "tree.h"
#include "except.h"
#include "function.h"
@@ -65,7 +65,7 @@ handle_pragma_token (string, token)
if (HANDLE_PRAGMA_WEAK)
handle_pragma_weak (state, name, value);
-#endif /* HANDLE_PRAMA_WEAK */
+#endif /* HANDLE_PRAGMA_WEAK */
}
type = state = ps_start;
@@ -82,7 +82,16 @@ handle_pragma_token (string, token)
else if (strcmp (IDENTIFIER_POINTER (token), "weak") == 0)
type = state = ps_weak;
else
- type = state = ps_done;
+ {
+ type = state = ps_done;
+
+ /* Issue a warning message if we have been asked to do so.
+ Ignoring unknown pragmas in system header file unless
+ an explcit -Wunknown-pragmas has been given. */
+ if (warn_unknown_pragmas > 1
+ || (warn_unknown_pragmas && ! in_system_header))
+ warning ("ignoring pragma: %s", string);
+ }
}
else
type = state = ps_done;