- output_fn <- liftIO $ get_output_fn dflags (HsPp sf) maybe_loc
- liftIO $ doCpp dflags True{-raw-} False{-no CC opts-} input_fn output_fn
- return (HsPp sf, dflags, maybe_loc, output_fn)
+ output_fn <- liftIO $ get_output_fn dflags1 (HsPp sf) maybe_loc
+ liftIO $ doCpp dflags1 True{-raw-} False{-no CC opts-} input_fn output_fn
+ -- re-read the pragmas now that we've preprocessed the file
+ -- See #2464,#3457
+ src_opts <- liftIO $ getOptionsFromFile dflags0 output_fn
+ (dflags2, unhandled_flags, warns)
+ <- liftIO $ parseDynamicNoPackageFlags dflags0 src_opts
+ unless (dopt Opt_Pp dflags2) $ handleFlagWarnings dflags2 warns
+ -- the HsPp pass below will emit warnings
+ checkProcessArgsResult unhandled_flags
+
+ return (HsPp sf, dflags2, maybe_loc, output_fn)