[PATCH] spec: replace lllong_ctype by int128_ctype

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

 



Sparse knows about __int128_t, __uint128_t & __int128.

However, internally, these types are treated as a kind of 128-bit
'long long long' type. It's mainly a question of variable naming,
but these types are also displayed by show_typename() as
'long long long' which can't be parsed back, neither by GCC,
nor even  by sparse itself.

So, rename the variables to use 'int128' and let show_typename()
display these types as '[signed|unsigned] __int128'.

Reported-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 parse.c      | 14 +++++++-------
 show-parse.c |  6 +++---
 symbol.c     |  8 ++++----
 symbol.h     |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/parse.c b/parse.c
index 4f7ba0c9a..6db3cba73 100644
--- a/parse.c
+++ b/parse.c
@@ -493,8 +493,8 @@ static struct init_keyword {
 	/* Predeclared types */
 	{ "__builtin_va_list", NS_TYPEDEF, .type = &ptr_ctype, .op = &spec_op },
 	{ "__builtin_ms_va_list", NS_TYPEDEF, .type = &ptr_ctype, .op = &spec_op },
-	{ "__int128_t",	NS_TYPEDEF, .type = &lllong_ctype, .op = &spec_op },
-	{ "__uint128_t",NS_TYPEDEF, .type = &ulllong_ctype, .op = &spec_op },
+	{ "__int128_t",	NS_TYPEDEF, .type = &sint128_ctype, .op = &spec_op },
+	{ "__uint128_t",NS_TYPEDEF, .type = &uint128_ctype, .op = &spec_op },
 	{ "_Float32",	NS_TYPEDEF, .type = &float32_ctype, .op = &spec_op },
 	{ "_Float32x",	NS_TYPEDEF, .type = &float32x_ctype, .op = &spec_op },
 	{ "_Float64",	NS_TYPEDEF, .type = &float64_ctype, .op = &spec_op },
@@ -1229,8 +1229,8 @@ static struct symbol *to_TI_mode(struct symbol *ctype)
 {
 	if (ctype->ctype.base_type != &int_type)
 		return NULL;
-	return ctype->ctype.modifiers & MOD_UNSIGNED ? &ulllong_ctype
-						     : &slllong_ctype;
+	return ctype->ctype.modifiers & MOD_UNSIGNED ? &uint128_ctype
+						     : &sint128_ctype;
 }
 
 static struct symbol *to_pointer_mode(struct symbol *ctype)
@@ -1569,13 +1569,13 @@ Catch_all:
 }
 
 static struct symbol * const int_types[] =
-	{&char_ctype, &short_ctype, &int_ctype, &long_ctype, &llong_ctype, &lllong_ctype};
+	{&char_ctype, &short_ctype, &int_ctype, &long_ctype, &llong_ctype, &int128_ctype};
 static struct symbol * const signed_types[] =
 	{&schar_ctype, &sshort_ctype, &sint_ctype, &slong_ctype, &sllong_ctype,
-	 &slllong_ctype};
+	 &sint128_ctype};
 static struct symbol * const unsigned_types[] =
 	{&uchar_ctype, &ushort_ctype, &uint_ctype, &ulong_ctype, &ullong_ctype,
-	 &ulllong_ctype};
+	 &uint128_ctype};
 static struct symbol * const real_types[] =
 	{&float_ctype, &double_ctype, &ldouble_ctype};
 static struct symbol * const * const types[] = {
diff --git a/show-parse.c b/show-parse.c
index a0436cbe0..f0ea9caea 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -235,9 +235,9 @@ static struct ctype_name {
 	{ & llong_ctype, "long long", "LL" },
 	{ &sllong_ctype, "signed long long", "LL" },
 	{ &ullong_ctype, "unsigned long long", "ULL" },
-	{ & lllong_ctype, "long long long", "LLL" },
-	{ &slllong_ctype, "signed long long long", "LLL" },
-	{ &ulllong_ctype, "unsigned long long long", "ULLL" },
+	{ & int128_ctype, "__int128", "" },
+	{ &sint128_ctype, "signed __int128", "" },
+	{ &uint128_ctype, "unsigned __int128", "" },
 
 	{ &void_ctype,   "void", "" },
 	{ &bool_ctype,   "bool", "" },
diff --git a/symbol.c b/symbol.c
index 79951a076..53ea037a5 100644
--- a/symbol.c
+++ b/symbol.c
@@ -694,7 +694,7 @@ struct symbol	bool_ctype, void_ctype, type_ctype,
 		int_ctype, sint_ctype, uint_ctype,
 		long_ctype, slong_ctype, ulong_ctype,
 		llong_ctype, sllong_ctype, ullong_ctype,
-		lllong_ctype, slllong_ctype, ulllong_ctype,
+		int128_ctype, sint128_ctype, uint128_ctype,
 		float_ctype, double_ctype, ldouble_ctype,
 		string_ctype, ptr_ctype, lazy_ptr_ctype,
 		incomplete_ctype, label_ctype, bad_ctype,
@@ -774,9 +774,9 @@ static const struct ctype_declare {
 	{ &llong_ctype,        T__INT( 2, longlong) },
 	{ &sllong_ctype,       T_SINT( 2, longlong) },
 	{ &ullong_ctype,       T_UINT( 2, longlong) },
-	{ &lllong_ctype,       T__INT( 3, longlonglong) },
-	{ &slllong_ctype,      T_SINT( 3, longlonglong) },
-	{ &ulllong_ctype,      T_UINT( 3, longlonglong) },
+	{ &int128_ctype,       T__INT( 3, type128) },
+	{ &sint128_ctype,      T_SINT( 3, type128) },
+	{ &uint128_ctype,      T_UINT( 3, type128) },
 
 	{ &float_ctype,        T_FLOAT(-1, float) },
 	{ &double_ctype,       T_FLOAT( 0, double) },
diff --git a/symbol.h b/symbol.h
index ad65a9044..e60d91365 100644
--- a/symbol.h
+++ b/symbol.h
@@ -272,7 +272,7 @@ extern struct symbol	bool_ctype, void_ctype, type_ctype,
 			int_ctype, sint_ctype, uint_ctype,
 			long_ctype, slong_ctype, ulong_ctype,
 			llong_ctype, sllong_ctype, ullong_ctype,
-			lllong_ctype, slllong_ctype, ulllong_ctype,
+			int128_ctype, sint128_ctype, uint128_ctype,
 			float_ctype, double_ctype, ldouble_ctype,
 			string_ctype, ptr_ctype, lazy_ptr_ctype,
 			incomplete_ctype, label_ctype, bad_ctype,
-- 
2.24.0




[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