Created
July 18, 2013 17:47
-
-
Save shanecelis/6031372 to your computer and use it in GitHub Desktop.
This file exhibits a lots of warnings in a C file that calls GNU Guile. The warnings are shown only when there is a compilation error.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This file exhibits a lots of warnings in a C file that calls GNU | |
Guile. The warnings are shown only when there is a compilation error. | |
Shane Celis | |
*/ | |
#include <libguile.h> | |
#define C_STRING_TO_SYMBOL(str) scm_string_to_symbol(scm_from_locale_string(str)) | |
SCM scm_c_array_to_aliased_f64_vector(int count, double* array) | |
{ | |
// Include an if clause maybe. | |
#ifdef IFCLAUSE | |
SCM x = SCM_BOOL_F; | |
if (scm_is_false(x)) { | |
x = SCM_BOOL_T; | |
} | |
#endif | |
return scm_pointer_to_bytevector(scm_from_pointer( | |
// Include an error maybe. | |
#ifdef ERROR | |
xreal | |
#else | |
array | |
#endif | |
, NULL), scm_from_int(count), scm_from_int(0), C_STRING_TO_SYMBOL("f64")); | |
} | |
/* | |
$ clang `pkg-config guile-2.0 --cflags` -c -o show-errors.o show-errors.c; | |
$ # WORKS! | |
$ clang -DERROR `pkg-config guile-2.0 --cflags` -c -o show-errors.o show-errors.c; | |
show-errors.c:22:1: error: use of undeclared identifier 'xreal' | |
xreal | |
^ | |
1 error generated. | |
$ # JUST THE ERROR. GOOD. | |
$ clang -DIFCLAUSE `pkg-config guile-2.0 --cflags` -c -o show-errors.o show-errors.c; | |
$ # No warnings if there is no error. | |
$ # Here we have a compiler error that then causes a lot of warnings for every scm_is_false; NOT GOOD. | |
$ clang -DIFCLAUSE -DERROR `pkg-config guile-2.0 --cflags` -c -o show-errors.o show-errors.c | |
show-errors.c:11:53: error: use of undeclared identifier 'xreal' | |
return scm_pointer_to_bytevector(scm_from_pointer(xreal, NULL), scm_from_int(count), scm_from_int(0), C_STRING_TO_SYMBOL("f64")); | |
^ | |
show-errors.c:8:7: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] | |
if (scm_is_false(x)) { | |
^~~~~~~~~~~~~~~ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:574:5: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^~~~~~~~ | |
show-errors.c:8:7: note: consider using __builtin_trap() or qualifying pointer with 'volatile' | |
if (scm_is_false(x)) { | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:574:5: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^ | |
show-errors.c:8:7: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] | |
if (scm_is_false(x)) { | |
^~~~~~~~~~~~~~~ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:574:23: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^~~~~~~~ | |
show-errors.c:8:7: note: consider using __builtin_trap() or qualifying pointer with 'volatile' | |
if (scm_is_false(x)) { | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:574:23: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^ | |
show-errors.c:8:7: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] | |
if (scm_is_false(x)) { | |
^~~~~~~~~~~~~~~ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:574:39: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^~~~~~~~ | |
show-errors.c:8:7: note: consider using __builtin_trap() or qualifying pointer with 'volatile' | |
if (scm_is_false(x)) { | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:574:39: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
((SCM_UNPACK(x) & ~(SCM_UNPACK(a) ^ SCM_UNPACK(b))) == \ | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^ | |
show-errors.c:8:7: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] | |
if (scm_is_false(x)) { | |
^~~~~~~~~~~~~~~ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:575:5: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
(SCM_UNPACK(a) & SCM_UNPACK(b))) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^~~~~~~~ | |
show-errors.c:8:7: note: consider using __builtin_trap() or qualifying pointer with 'volatile' | |
if (scm_is_false(x)) { | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:575:5: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
(SCM_UNPACK(a) & SCM_UNPACK(b))) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^ | |
show-errors.c:8:7: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] | |
if (scm_is_false(x)) { | |
^~~~~~~~~~~~~~~ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:575:21: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
(SCM_UNPACK(a) & SCM_UNPACK(b))) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^~~~~~~~ | |
show-errors.c:8:7: note: consider using __builtin_trap() or qualifying pointer with 'volatile' | |
if (scm_is_false(x)) { | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:60:27: note: expanded from macro 'scm_is_false' | |
#define scm_is_false(x) (scm_is_false_or_nil (x)) | |
^ | |
/usr/local/include/guile/2.0/libguile/boolean.h:56:4: note: expanded from macro 'scm_is_false_or_nil' | |
(SCM_MATCHES_BITS_IN_COMMON ((x), SCM_ELISP_NIL, SCM_BOOL_F)) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:575:21: note: expanded from macro 'SCM_MATCHES_BITS_IN_COMMON' | |
(SCM_UNPACK(a) & SCM_UNPACK(b))) | |
^ | |
/usr/local/include/guile/2.0/libguile/tags.h:97:45: note: expanded from macro 'SCM_UNPACK' | |
# define SCM_UNPACK(x) ((scm_t_bits) (0? (*(SCM*)0=(x)): x)) | |
^ | |
5 warnings and 1 error generated. | |
$ clang --version | |
Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn) | |
Target: x86_64-apple-darwin12.3.0 | |
Thread model: posix | |
$ guile --version | |
guile (GNU Guile) 2.0.9 | |
Copyright (C) 2013 Free Software Foundation, Inc. | |
License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>. | |
This is free software: you are free to change and redistribute it. | |
There is NO WARRANTY, to the extent permitted by law. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment