Package: clang Version: 2.6-3 Severity: normal Clangs behaviour differs depending on where NULL is defined. If NULL is defined locally, a warning is issued if NULL is assigned to an int variable. If the (same) definition of NULL is included via a header file, no warning is issued.
1. Definition of NULL in clang's stddef.h ========================================== #ifdef __cplusplus #define NULL __null #else #define NULL ((void*)0) #endif 2. Code causing a warning ========================= #define NULL ((void*)0) int main(void) { int i = NULL; return 0; } 2.1. Output compiling example 2 ------------------------------- a.c:4:12: warning: incompatible pointer to integer conversion initializing 'void *', expected 'int' int i = NULL; ^~~~ a.c:1:14: note: instantiated from: #define NULL ((void*)0) ^~~~~~~~~~ 1 diagnostic generated. 3. Code without warning ======================== #include <stdlib.h> int main(void) { int i = NULL; return 0; } 3.1 Output compiling example 3 ------------------------------ (Well, there is no output at all) -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (990, 'unstable'), (350, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages clang depends on: ii libc6 2.11.1-2 Embedded GNU C Library: Shared lib ii libffi5 3.0.9-2 Foreign Function Interface library ii libgcc1 1:4.4.4-4 GCC support library ii libstdc++6 4.4.4-4 The GNU Standard C++ Library v3 Versions of packages clang recommends: ii llvm-dev 2.6-9 Low-Level Virtual Machine (LLVM), clang suggests no packages. -- no debconf information -- Julian Andres Klode - Debian Developer, Ubuntu Member See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.
pgpV0AtCb8oyU.pgp
Description: PGP signature