* [PATCH 1/2] lib: rename die_if_error to error_happened
@ 2012-10-08 23:17 Jonathan Neuschäfer
2012-10-08 23:17 ` [PATCH 2/2] sparse, llvm: don't compile erroneous code Jonathan Neuschäfer
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Neuschäfer @ 2012-10-08 23:17 UTC (permalink / raw)
To: linux-sparse
Cc: Jonathan Neuschäfer, Mitesh Shah, Christopher Li,
Jeff Garzik
The variable in question is set when an error message is output,
and doesn't control termination at all, so I think the new name
matches the semantics better.
Cc: Mitesh Shah <mshah@teja.com>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
lib.c | 4 ++--
lib.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib.c b/lib.c
index b4d3944..1172dc2 100644
--- a/lib.c
+++ b/lib.c
@@ -29,7 +29,7 @@
#include "target.h"
int verbose, optimize, optimize_size, preprocessing;
-int die_if_error = 0;
+int error_happened = 0;
#ifndef __GNUC__
# define __GNUC__ 2
@@ -131,7 +131,7 @@ void warning(struct position pos, const char * fmt, ...)
static void do_error(struct position pos, const char * fmt, va_list args)
{
static int errors = 0;
- die_if_error = 1;
+ error_happened = 1;
show_info = 1;
/* Shut up warnings after an error */
max_warnings = 0;
diff --git a/lib.h b/lib.h
index 2cea252..7cde9c2 100644
--- a/lib.h
+++ b/lib.h
@@ -25,7 +25,7 @@
#endif
extern int verbose, optimize, optimize_size, preprocessing;
-extern int die_if_error;
+extern int error_happened;
extern int repeat_phase, merge_phi_sources;
extern int gcc_major, gcc_minor, gcc_patchlevel;
--
1.7.10.4
--
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 related [flat|nested] 3+ messages in thread
* [PATCH 2/2] sparse, llvm: don't compile erroneous code
2012-10-08 23:17 [PATCH 1/2] lib: rename die_if_error to error_happened Jonathan Neuschäfer
@ 2012-10-08 23:17 ` Jonathan Neuschäfer
2012-10-09 6:30 ` Pekka Enberg
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Neuschäfer @ 2012-10-08 23:17 UTC (permalink / raw)
To: linux-sparse
Cc: Jonathan Neuschäfer, Pekka Enberg, Christopher Li,
Jeff Garzik, Linus Torvalds
If sparse emits an error message while parsing a file, don't
generate LLVM code, and also don't parse further files. This
prevents a segfault when sparse-llvm is fed with certain junk.
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
sparse-llvm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sparse-llvm.c b/sparse-llvm.c
index e4929e9..0fc0dae 100644
--- a/sparse-llvm.c
+++ b/sparse-llvm.c
@@ -1268,7 +1268,10 @@ int main(int argc, char **argv)
compile(module, sparse_initialize(argc, argv, &filelist));
FOR_EACH_PTR_NOTAG(filelist, file) {
- compile(module, sparse(file));
+ struct symbol_list *symlist = sparse(file);
+ if (error_happened)
+ break;
+ compile(module, symlist);
} END_FOR_EACH_PTR_NOTAG(file);
LLVMVerifyModule(module, LLVMPrintMessageAction, NULL);
--
1.7.10.4
--
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 related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] sparse, llvm: don't compile erroneous code
2012-10-08 23:17 ` [PATCH 2/2] sparse, llvm: don't compile erroneous code Jonathan Neuschäfer
@ 2012-10-09 6:30 ` Pekka Enberg
0 siblings, 0 replies; 3+ messages in thread
From: Pekka Enberg @ 2012-10-09 6:30 UTC (permalink / raw)
To: Jonathan Neuschäfer
Cc: linux-sparse, Christopher Li, Jeff Garzik, Linus Torvalds
On Tue, Oct 9, 2012 at 2:17 AM, Jonathan Neuschäfer
<j.neuschaefer@gmx.net> wrote:
> If sparse emits an error message while parsing a file, don't
> generate LLVM code, and also don't parse further files. This
> prevents a segfault when sparse-llvm is fed with certain junk.
>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: Christopher Li <sparse@chrisli.org>
> Cc: Jeff Garzik <jgarzik@redhat.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Acked-by: Pekka Enberg <penberg@kernel.org>
Chris, this depends on the first patch so please just take this
directly to your tree.
--
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] 3+ messages in thread
end of thread, other threads:[~2012-10-09 6:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 23:17 [PATCH 1/2] lib: rename die_if_error to error_happened Jonathan Neuschäfer
2012-10-08 23:17 ` [PATCH 2/2] sparse, llvm: don't compile erroneous code Jonathan Neuschäfer
2012-10-09 6:30 ` 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).