diff mbox series

fix is_scalar_type(): fouled types are scalars

Message ID 20200811164740.43766-1-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series fix is_scalar_type(): fouled types are scalars | expand

Commit Message

Luc Van Oostenryck Aug. 11, 2020, 4:47 p.m. UTC
is_scalar_type() accept SYM_RESTRICT but not SYM_FOULED
but both are for integer types (and only for them).

So, let it accept SYM_FOULED too. Same for is_integral_type().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 symbol.h                 |  2 ++
 validation/foul-scalar.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100644 validation/foul-scalar.c
diff mbox series

Patch

diff --git a/symbol.h b/symbol.h
index 873d69fcf547..a3ed95678ee5 100644
--- a/symbol.h
+++ b/symbol.h
@@ -463,6 +463,7 @@  static inline int is_scalar_type(struct symbol *type)
 	case SYM_BITFIELD:
 	case SYM_PTR:
 	case SYM_RESTRICT:	// OK, always integer types
+	case SYM_FOULED:	// idem
 		return 1;
 	default:
 		break;
@@ -483,6 +484,7 @@  static inline bool is_integral_type(struct symbol *type)
 	case SYM_ENUM:
 	case SYM_PTR:
 	case SYM_RESTRICT:	// OK, always integer types
+	case SYM_FOULED:	// idem
 		return 1;
 	default:
 		break;
diff --git a/validation/foul-scalar.c b/validation/foul-scalar.c
new file mode 100644
index 000000000000..8e053b96edbd
--- /dev/null
+++ b/validation/foul-scalar.c
@@ -0,0 +1,13 @@ 
+#define __bitwise __attribute__((bitwise))
+
+typedef unsigned short __bitwise __be16;
+
+static void foo(__be16 x)
+{
+	if (~x)
+		;
+}
+
+/*
+ * check-name: foul-scalar
+ */