This is used to control warnings that were previously unconditional.
| Opt_WarnUnusedMatches
| Opt_WarnWarningsDeprecations
| Opt_WarnDeprecatedFlags
+ | Opt_WarnDodgyExports
| Opt_WarnDodgyImports
| Opt_WarnOrphans
| Opt_WarnTabs
Opt_WarnUnusedMatches,
Opt_WarnUnusedImports,
Opt_WarnIncompletePatterns,
+ Opt_WarnDodgyExports,
Opt_WarnDodgyImports
]
fFlags :: [(String, DynFlag, Bool -> Deprecated)]
fFlags = [
( "warn-dodgy-foreign-imports", Opt_WarnDodgyForeignImports, const Supported ),
+ ( "warn-dodgy-exports", Opt_WarnDodgyExports, const Supported ),
( "warn-dodgy-imports", Opt_WarnDodgyImports, const Supported ),
( "warn-duplicate-exports", Opt_WarnDuplicateExports, const Supported ),
( "warn-hi-shadowing", Opt_WarnHiShadows, const Supported ),
| otherwise
= do { implicit_prelude <- doptM Opt_ImplicitPrelude
+ ; warnDodgyExports <- doptM Opt_WarnDodgyExports
; let { exportValid = (mod `elem` imported_modules)
|| (moduleName this_mod == mod)
; gres = filter (isModuleExported implicit_prelude mod)
}
; checkErr exportValid (moduleNotImported mod)
- ; warnIf (exportValid && null gres) (nullModuleExport mod)
+ ; warnIf (warnDodgyExports && exportValid && null gres) (nullModuleExport mod)
; addUsedRdrNames (concat [ [mkRdrQual mod occ, mkRdrUnqual occ]
| occ <- map nameOccName names ])
Nothing -> mkRdrUnqual
Just (modName, _) -> mkRdrQual modName
addUsedRdrNames $ map (mkKidRdrName . nameOccName) kids
- when (null kids)
- (if (isTyConName name) then addWarn (dodgyExportWarn name)
- -- This occurs when you export T(..), but
- -- only import T abstractly, or T is a synonym.
- else addErr (exportItemErr ie))
-
+ warnDodgyExports <- doptM Opt_WarnDodgyExports
+ when (null kids) $
+ if isTyConName name
+ then when warnDodgyExports $ addWarn (dodgyExportWarn name)
+ else -- This occurs when you export T(..), but
+ -- only import T abstractly, or T is a synonym.
+ addErr (exportItemErr ie)
+
return (IEThingAll name, AvailTC name (name:kids))
lookup_ie ie@(IEThingWith rdr sub_rdrs)
<indexterm><primary>-W option</primary></indexterm>
<para>Provides the standard warnings plus
<option>-fwarn-incomplete-patterns</option>,
+ <option>-fwarn-dodgy-exports</option>,
<option>-fwarn-dodgy-imports</option>,
<option>-fwarn-unused-matches</option>,
<option>-fwarn-unused-imports</option>, and
</varlistentry>
<varlistentry>
+ <term><option>-fwarn-dodgy-exports</option>:</term>
+ <listitem>
+ <indexterm><primary><option>-fwarn-dodgy-exports</option></primary>
+ </indexterm>
+ <para>Causes a warning to be emitted when a datatype
+ <literal>T</literal> is exported
+ with all constructors, i.e. <literal>T(..)</literal>, but is it
+ just a type synonym.</para>
+ <para>Also causes a warning to be emitted when a module is
+ re-exported, but that module exports nothing.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-fwarn-dodgy-imports</option>:</term>
<listitem>
<indexterm><primary><option>-fwarn-dodgy-imports</option></primary>