sparse, llvm: Use LLVMInt1Type() in sym_basetype_type()
PATCH 1/3 sparse, llvm: Use LLVMInt1Type() in sym_basetype_type()
In preparation for reverting commit 2ded1e7 ("sparse: Bump up sizeof(_Bool) to 8 bits"), teach sym_basetype_type() about LLVMInt1Type().
--- sparse-llvm.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
sparse-llvm.c +3 -0
@@ -175,6 +175,9 @@ static LLVMTypeRef sym_basetype_type(struct symbol *sym) } }else {switch (sym->bit_size) { +case 1 : + ret =LLVMInt1Type (); +break ;case -1 :/* 'void *' is treated like 'char *' */ case 8 : ret =LLVMInt8Type ();
Signature · 1 line
1.7.6.4
PATCH 2/3 sparse, llvm: Add test case for <stdbool.h> type
As it turns out, our validation test harness doesn't catch <stdbool.h> related breakage so add a minimal test case that does.
--- validation/backend/bool-test.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) create mode 100644 validation/backend/bool-test.c
validation/backend/bool-test.c new file +11 -0
@@ -0,0 +1,11 @@ +#include <stdbool.h> + +static bool return_false (void ) +{ +return false; +} + +/* +* check-name: Boolean type code generation +* check-command: ./sparsec -c $file -o tmp.o +*/
Signature · 1 line
1.7.6.4
PATCH 3/3 Revert "sparse: Bump up sizeof(_Bool) to 8 bits"
In reply to Pekka EnbergThis reverts commit 2ded1e7406914eda77abde035416140849d76f68. It's no longer needed as LLVM backend supports 1-bit integers.
--- target.c | 2 +- validation/sizeof-bool.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-)
target.c +1 -1
@@ -14,7 +14,7 @@ int max_alignment = 16;/* * Integer data types */ -int bits_in_bool =8 ; +int bits_in_bool =1 ;int bits_in_char =8 ;int bits_in_short =16 ;int bits_in_int =32 ;
validation/sizeof-bool.c +5 -1
@@ -4,5 +4,9 @@ static int a(void) }/* * check-name: sizeof(_Bool) is valid -* check-description: sizeof(_Bool) is valid +* check-description: sizeof(_Bool) was rejected because _Bool is not an even +* number of bytes +* check-error-start +sizeof-bool.c:3:16: warning: expression using sizeof bool +* check-error-end */
Signature · 1 line
1.7.6.4
Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
In reply to Pekka EnbergQuoted 2 lines · Pekka Enberg
As it turns out, our validation test harness doesn't catch <
stdbool.h> related breakage so add a minimal test case that does.
[...]
validation/backend/bool-test.c line 6
Quoted 9 lines
validation/backend/bool-test.c new file +6
-0@@ -0,0 +1,11 @@ +#include <stdbool.h> + +static bool return_false (void ) +{ +return false; +}
Do we want tests that depend on system header files?
- Josh Triplett
Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
Quoted 12 lines · Pekka Enberg
Quoted 2 lines
As it turns out, our validation test harness doesn't catch <
stdbool.h> related breakage so add a minimal test case that does.[...]
Quoted 9 lines
validation/backend/bool-test.c new file +6
-0@@ -0,0 +1,11 @@ +#include <stdbool.h> + +static bool return_false (void ) +{ + return false; +}
Quoted 1 line · Josh Triplett
Do we want tests that depend on system header files?
I changed it to use _Bool instead. Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Christopher Li
maintainerRe: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
Quoted 4 lines · Pekka Enberg
Quoted 1 line · Josh Triplett
Do we want tests that depend on system header files?
I changed it to use
_Boolinstead. Thanks!
This series looks great to me.
Thanks
Chris
Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
Quoted 1 line · Josh Triplett
Quoted 1 line
Quoted 1 line
Do we want tests that depend on system header files?
Quoted 1 line · Pekka Enberg
Quoted 1 line
I changed it to use
_Boolinstead. Thanks!
Quoted 1 line · Christopher Li
This series looks great to me.
The patches are in master branch of:
git://github.com/penberg/sparse-llvm.git