[PATCH] Ignore #ident directives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Legacy code can be littered with the non-standard "#ident" directive;
ignore it.

Signed-off-by: John Levon <levon@xxxxxxxxxxxxxxxxx>
---
 pre-process.c                   |  6 ++++++
 validation/preprocessor/ident.c | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 validation/preprocessor/ident.c

diff --git a/pre-process.c b/pre-process.c
index bf4b8e7..1ed7a47 100644
--- a/pre-process.c
+++ b/pre-process.c
@@ -1977,6 +1977,11 @@ static int handle_line(struct stream *stream, struct token **line, struct token
 	return 1;
 }
 
+static int handle_ident(struct stream *stream, struct token **line, struct token *token)
+{
+	return 1;
+}
+
 static int handle_nondirective(struct stream *stream, struct token **line, struct token *token)
 {
 	sparse_error(token->pos, "unrecognized preprocessor line '%s'", show_token_sequence(token, 0));
@@ -2003,6 +2008,7 @@ static void init_preprocessor(void)
 		{ "include_next",	handle_include_next },
 		{ "pragma",		handle_pragma },
 		{ "line",		handle_line },
+		{ "ident",		handle_ident },
 
 		// our internal preprocessor tokens
 		{ "nostdinc",	   handle_nostdinc },
diff --git a/validation/preprocessor/ident.c b/validation/preprocessor/ident.c
new file mode 100644
index 0000000..55dc382
--- /dev/null
+++ b/validation/preprocessor/ident.c
@@ -0,0 +1,17 @@
+#ident "%Z%%M% %I%     %E%"
+#pragma ident  "foo"
+
+/*
+ * check-description:
+ *	The non-standard "ident" directive is ignored.
+ * check-name: ident
+ * check-command: sparse -E $file
+ *
+ * check-output-start
+
+
+ * check-output-end
+ *
+ * check-error-start
+ * check-error-end
+ */
-- 
1.8.3.1




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux