linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] sparse, llvm: Use LLVMInt1Type() in sym_basetype_type()
@ 2011-12-21  9:25 Pekka Enberg
  2011-12-21  9:25 ` [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type Pekka Enberg
  2011-12-21  9:25 ` [PATCH 3/3] Revert "sparse: Bump up sizeof(_Bool) to 8 bits" Pekka Enberg
  0 siblings, 2 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-12-21  9:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Pekka Enberg, Christopher Li, Jeff Garzik, Linus Torvalds

In preparation for reverting commit 2ded1e7 ("sparse: Bump up sizeof(_Bool) to
8 bits"), teach sym_basetype_type() about LLVMInt1Type().

Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 sparse-llvm.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sparse-llvm.c b/sparse-llvm.c
index 38f40fc..a291a0d 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -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();
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
  2011-12-21  9:25 [PATCH 1/3] sparse, llvm: Use LLVMInt1Type() in sym_basetype_type() Pekka Enberg
@ 2011-12-21  9:25 ` Pekka Enberg
  2011-12-21  9:58   ` Josh Triplett
  2011-12-21  9:25 ` [PATCH 3/3] Revert "sparse: Bump up sizeof(_Bool) to 8 bits" Pekka Enberg
  1 sibling, 1 reply; 7+ messages in thread
From: Pekka Enberg @ 2011-12-21  9:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Pekka Enberg, Christopher Li, Jeff Garzik, Linus Torvalds

As it turns out, our validation test harness doesn't catch <stdbool.h> related
breakage so add a minimal test case that does.

Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 validation/backend/bool-test.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
 create mode 100644 validation/backend/bool-test.c

diff --git a/validation/backend/bool-test.c b/validation/backend/bool-test.c
new file mode 100644
index 0000000..51ae356
--- /dev/null
+++ b/validation/backend/bool-test.c
@@ -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
+ */
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] Revert "sparse: Bump up sizeof(_Bool) to 8 bits"
  2011-12-21  9:25 [PATCH 1/3] sparse, llvm: Use LLVMInt1Type() in sym_basetype_type() Pekka Enberg
  2011-12-21  9:25 ` [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type Pekka Enberg
@ 2011-12-21  9:25 ` Pekka Enberg
  1 sibling, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-12-21  9:25 UTC (permalink / raw)
  To: linux-sparse; +Cc: Pekka Enberg, Christopher Li, Jeff Garzik, Linus Torvalds

This reverts commit 2ded1e7406914eda77abde035416140849d76f68. It's no longer
needed as LLVM backend supports 1-bit integers.

Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 target.c                 |    2 +-
 validation/sizeof-bool.c |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/target.c b/target.c
index 6a535bc..17b228a 100644
--- a/target.c
+++ b/target.c
@@ -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;
diff --git a/validation/sizeof-bool.c b/validation/sizeof-bool.c
index 71ae1bc..6c68748 100644
--- a/validation/sizeof-bool.c
+++ b/validation/sizeof-bool.c
@@ -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
  */
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
  2011-12-21  9:25 ` [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type Pekka Enberg
@ 2011-12-21  9:58   ` Josh Triplett
  2011-12-21 10:18     ` Pekka Enberg
  0 siblings, 1 reply; 7+ messages in thread
From: Josh Triplett @ 2011-12-21  9:58 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: linux-sparse, Christopher Li, Jeff Garzik, Linus Torvalds

On Wed, Dec 21, 2011 at 11:25:27AM +0200, Pekka Enberg wrote:
> As it turns out, our validation test harness doesn't catch <stdbool.h> related
> breakage so add a minimal test case that does.
[...]
> --- /dev/null
> +++ b/validation/backend/bool-test.c
> @@ -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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
  2011-12-21  9:58   ` Josh Triplett
@ 2011-12-21 10:18     ` Pekka Enberg
  2011-12-22  0:23       ` Christopher Li
  0 siblings, 1 reply; 7+ messages in thread
From: Pekka Enberg @ 2011-12-21 10:18 UTC (permalink / raw)
  To: Josh Triplett; +Cc: linux-sparse, Christopher Li, Jeff Garzik, Linus Torvalds

On Wed, Dec 21, 2011 at 11:25:27AM +0200, Pekka Enberg wrote:
>> As it turns out, our validation test harness doesn't catch <stdbool.h> related
>> breakage so add a minimal test case that does.
> [...]
>> --- /dev/null
>> +++ b/validation/backend/bool-test.c
>> @@ -0,0 +1,11 @@
>> +#include <stdbool.h>
>> +
>> +static bool return_false(void)
>> +{
>> +     return false;
>> +}

On Wed, Dec 21, 2011 at 11:58 AM, Josh Triplett <josh@joshtriplett.org> wrote:
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
  2011-12-21 10:18     ` Pekka Enberg
@ 2011-12-22  0:23       ` Christopher Li
  2011-12-22  5:53         ` Pekka Enberg
  0 siblings, 1 reply; 7+ messages in thread
From: Christopher Li @ 2011-12-22  0:23 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Josh Triplett, linux-sparse, Jeff Garzik, Linus Torvalds

On Wed, Dec 21, 2011 at 2:18 AM, Pekka Enberg <penberg@kernel.org> wrote:
> On Wed, Dec 21, 2011 at 11:58 AM, Josh Triplett <josh@joshtriplett.org> wrote:
>> Do we want tests that depend on system header files?
>
> I changed it to use _Bool instead. Thanks!

This series looks great to me.

Thanks

Chris

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type
  2011-12-22  0:23       ` Christopher Li
@ 2011-12-22  5:53         ` Pekka Enberg
  0 siblings, 0 replies; 7+ messages in thread
From: Pekka Enberg @ 2011-12-22  5:53 UTC (permalink / raw)
  To: Christopher Li; +Cc: Josh Triplett, linux-sparse, Jeff Garzik, Linus Torvalds

On Wed, Dec 21, 2011 at 11:58 AM, Josh Triplett <josh@joshtriplett.org> wrote:
> >> Do we want tests that depend on system header files?

On Wed, Dec 21, 2011 at 2:18 AM, Pekka Enberg <penberg@kernel.org> wrote:
> > I changed it to use _Bool instead. Thanks!

On Wed, 2011-12-21 at 16:23 -0800, Christopher Li wrote:
> This series looks great to me.

The patches are in master branch of:

  git://github.com/penberg/sparse-llvm.git


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-22  5:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-21  9:25 [PATCH 1/3] sparse, llvm: Use LLVMInt1Type() in sym_basetype_type() Pekka Enberg
2011-12-21  9:25 ` [PATCH 2/3] sparse, llvm: Add test case for <stdbool.h> type Pekka Enberg
2011-12-21  9:58   ` Josh Triplett
2011-12-21 10:18     ` Pekka Enberg
2011-12-22  0:23       ` Christopher Li
2011-12-22  5:53         ` Pekka Enberg
2011-12-21  9:25 ` [PATCH 3/3] Revert "sparse: Bump up sizeof(_Bool) to 8 bits" Pekka Enberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).