Powered by Linux
[PATCH] Remove -Wempty-character-constant — Semantic Matching Tool

[PATCH] Remove -Wempty-character-constant

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

 



This comes down to the way sparse still tokenizes:

#ifdef NOT_DEFINED
	... = '';
#endif

unlike gcc, which won't see the illegal ''. Since the upstream code
is nonsense anyway, it seems of little use to have this flag.

Signed-off-by: John Levon <levon@xxxxxxxxxxxxxxxxx>
---
 cgcc       | 2 +-
 lib.c      | 2 --
 lib.h      | 1 -
 tokenize.c | 5 ++---
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/cgcc b/cgcc
index cdb05ab..04869c1 100755
--- a/cgcc
+++ b/cgcc
@@ -101,7 +101,7 @@ exit 0;
 
 sub check_only_option {
     my ($arg) = @_;
-    return 1 if $arg =~ /^-W(no-?)?(address-space|big-constants|bitwise|cast-to-as|cast-truncate|context|decl|default-bitfield-sign|designated-init|do-while|empty-character-constant|enum-mismatch|init-cstring|memcpy-max-count|non-ansi-function-declaration|non-pointer-null|old-initializer|one-bit-signed-bitfield|override-init-all|paren-string|ptr-subtraction-blows|return-void|sizeof-bool|sparse-all|sparse-error|transparent-union|typesign|undef|unknown-attribute)$/;
+    return 1 if $arg =~ /^-W(no-?)?(address-space|big-constants|bitwise|cast-to-as|cast-truncate|context|decl|default-bitfield-sign|designated-init|do-while|enum-mismatch|init-cstring|memcpy-max-count|non-ansi-function-declaration|non-pointer-null|old-initializer|one-bit-signed-bitfield|override-init-all|paren-string|ptr-subtraction-blows|return-void|sizeof-bool|sparse-all|sparse-error|transparent-union|typesign|undef|unknown-attribute)$/;
     return 1 if $arg =~ /^-v(no-?)?(entry|dead)$/;
     return 1 if $arg =~ /^-f(dump-linearize|memcpy-max-count)(=\S*)?$/;
     return 0;
diff --git a/lib.c b/lib.c
index 7cfc123..8924c2e 100644
--- a/lib.c
+++ b/lib.c
@@ -236,7 +236,6 @@ int Wdesignated_init = 1;
 int Wdo_while = 0;
 int Winit_cstring = 0;
 int Wenum_mismatch = 1;
-int Wempty_character_constant = 1;
 int Wsparse_error = 0;
 int Wmemcpy_max_count = 1;
 int Wnon_ansi_function_declaration = 1;
@@ -540,7 +539,6 @@ static const struct warning {
 	{ "default-bitfield-sign", &Wdefault_bitfield_sign },
 	{ "designated-init", &Wdesignated_init },
 	{ "do-while", &Wdo_while },
-	{ "empty-character-constant", &Wempty_character_constant },
 	{ "enum-mismatch", &Wenum_mismatch },
 	{ "init-cstring", &Winit_cstring },
 	{ "memcpy-max-count", &Wmemcpy_max_count },
diff --git a/lib.h b/lib.h
index d5693ed..bfb3546 100644
--- a/lib.h
+++ b/lib.h
@@ -126,7 +126,6 @@ extern int Wdefault_bitfield_sign;
 extern int Wdesignated_init;
 extern int Wdo_while;
 extern int Wenum_mismatch;
-extern int Wempty_character_constant;
 extern int Wsparse_error;
 extern int Winit_cstring;
 extern int Wmemcpy_max_count;
diff --git a/tokenize.c b/tokenize.c
index 12c1f43..ff5b136 100644
--- a/tokenize.c
+++ b/tokenize.c
@@ -630,9 +630,8 @@ static int eat_string(int next, stream_t *stream, enum token_type type)
 	}
 	if (delim == '\'' && len <= 4) {
 		if (len == 0) {
-			if (Wempty_character_constant)
-				sparse_error(stream_pos(stream),
-					"empty character constant");
+			sparse_error(stream_pos(stream),
+				"empty character constant");
 			return nextchar(stream);
 		}
 		token_type(token) = type + len;
-- 
1.8.3.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux