Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
76c6727d
Commit
76c6727d
authored
Jul 19, 2009
by
Ian Lynagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a -fwarn-dodgy-exports flag; fixes #1911
This is used to control warnings that were previously unconditional.
parent
5c8d5090
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs
+3
-0
compiler/rename/RnNames.lhs
compiler/rename/RnNames.lhs
+10
-7
docs/users_guide/using.xml
docs/users_guide/using.xml
+15
-0
No files found.
compiler/main/DynFlags.hs
View file @
76c6727d
...
...
@@ -186,6 +186,7 @@ data DynFlag
|
Opt_WarnUnusedMatches
|
Opt_WarnWarningsDeprecations
|
Opt_WarnDeprecatedFlags
|
Opt_WarnDodgyExports
|
Opt_WarnDodgyImports
|
Opt_WarnOrphans
|
Opt_WarnTabs
...
...
@@ -931,6 +932,7 @@ minusWOpts
Opt_WarnUnusedMatches
,
Opt_WarnUnusedImports
,
Opt_WarnIncompletePatterns
,
Opt_WarnDodgyExports
,
Opt_WarnDodgyImports
]
...
...
@@ -1652,6 +1654,7 @@ useInstead flag turn_on
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
),
...
...
compiler/rename/RnNames.lhs
View file @
76c6727d
...
...
@@ -893,6 +893,7 @@ exports_from_avail (Just rdr_items) rdr_env imports this_mod
| 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)
...
...
@@ -901,7 +902,7 @@ exports_from_avail (Just rdr_items) rdr_env imports this_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 ])
...
...
@@ -955,12 +956,14 @@ exports_from_avail (Just rdr_items) rdr_env imports this_mod
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)
...
...
docs/users_guide/using.xml
View file @
76c6727d
...
...
@@ -860,6 +860,7 @@ ghc -c Foo.hs</screen>
<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
...
...
@@ -990,6 +991,20 @@ foreign import "&f" f :: FunPtr t
</listitem>
</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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment