diff options
Diffstat (limited to 'nixpkgs/pkgs/test/cc-wrapper')
-rw-r--r-- | nixpkgs/pkgs/test/cc-wrapper/default.nix | 8 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/cc-wrapper/nostdinc-main.c | 8 | ||||
-rw-r--r-- | nixpkgs/pkgs/test/cc-wrapper/stdio.h | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/test/cc-wrapper/default.nix b/nixpkgs/pkgs/test/cc-wrapper/default.nix index 7bd82b4ab2a..c0c89d63fff 100644 --- a/nixpkgs/pkgs/test/cc-wrapper/default.nix +++ b/nixpkgs/pkgs/test/cc-wrapper/default.nix @@ -45,6 +45,14 @@ in stdenv.mkDerivation { NIX_LDFLAGS="-L$NIX_BUILD_TOP/foo/lib -rpath $NIX_BUILD_TOP/foo/lib" $CC -lfoo -o ldflags-check ${./ldflags-main.c} ./ldflags-check + printf "Check whether -nostdinc and -nostdinc++ is handled correctly" >&2 + mkdir -p std-include + cp ${./stdio.h} std-include/stdio.h + NIX_DEBUG=1 $CC -I std-include -nostdinc -o nostdinc-main ${./nostdinc-main.c} + ./nostdinc-main + $CXX -I std-include -nostdinc++ -o nostdinc-main++ ${./nostdinc-main.c} + ./nostdinc-main++ + ${optionalString sanitizersWorking '' printf "checking whether sanitizers are fully functional... ">&2 $CC -o sanitizers -fsanitize=address,undefined ${./sanitizers.c} diff --git a/nixpkgs/pkgs/test/cc-wrapper/nostdinc-main.c b/nixpkgs/pkgs/test/cc-wrapper/nostdinc-main.c new file mode 100644 index 00000000000..f71d155b1b2 --- /dev/null +++ b/nixpkgs/pkgs/test/cc-wrapper/nostdinc-main.c @@ -0,0 +1,8 @@ +// This one should not come from libc because of -nostdinc +#include <stdio.h> + +int main(int argc, char *argv[]) { + // provided by our own stdio.h + foo(); + return 0; +} diff --git a/nixpkgs/pkgs/test/cc-wrapper/stdio.h b/nixpkgs/pkgs/test/cc-wrapper/stdio.h new file mode 100644 index 00000000000..4bddf1d9d48 --- /dev/null +++ b/nixpkgs/pkgs/test/cc-wrapper/stdio.h @@ -0,0 +1 @@ +static void foo(void) {} |