From: simonmar Date: Thu, 30 Sep 2004 10:31:58 +0000 (+0000) Subject: [project @ 2004-09-30 10:31:58 by simonmar] X-Git-Tag: Initial_conversion_from_CVS_complete~1564 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=9b6858cb53438a2651ab00202582b13f95036058;hp=84295ea0a51756141bcba0f52e28510dff8a156f;p=ghc-hetmet.git [project @ 2004-09-30 10:31:58 by simonmar] Add -I- after the include paths when running gcc. This prevents accidental shadowing of system includes by putting a file called eg. stdint.h in the current directory. --- diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index 0116aee..c3ad556 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -688,6 +688,14 @@ runPhase cc_phase basename suff input_fn get_output_fn maybe_loc pkg_include_dirs <- getPackageIncludePath pkgs let include_paths = foldr (\ x xs -> "-I" : x : xs) [] (cmdline_include_paths ++ pkg_include_dirs) + ++ ["-I-"] + -- We add the flag -I- after all the include paths. + -- According to the gcc docs, this causes all -I paths + -- up to this point apply only to #include "..." + -- style includes. This prevents accidentally + -- shadowing a system include (eg. #include ) + -- by putting a file of the same name in the current + -- directory, for example. mangle <- readIORef v_Do_asm_mangling (md_c_flags, md_regd_c_flags) <- machdepCCOpts