[GHC] #13392: ghc --show-options lists flags twice

#13392: ghc --show-options lists flags twice --------------------------------------+--------------------------------- Reporter: ThreeFx | Owner: (none) Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Keywords: newcomer | Operating System: Linux Architecture: x86_64 (amd64) | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+--------------------------------- Running `ghc --show-options` with GHC version 8.0.1 returns the flags `-O` and `-W` twice. To check this, execute the following command in your shell: {{{ ghc --show-options | sort | uniq -d }}} At commit `669333d8afaf388a3ce4a56e383b24ea2bdea145` (GHC 8.1.20170304) only `-O` is duplicated. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: (none) Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by SantiM): Hello, I'd be happy to take this issue as my first contribution to GHC. I wanted to ask a few questions first though: 1) I didn't find tests on the 'ghc' command or the "showOptions" function[0]. Any suggestions on where to put the test for this change and how to go about it? 2) We could fix this by just adding 'nub' to the showOptions, but I guess that is not good enough and we probably want to take a look at how flags are registered in DynFlags. Ideas? Thanks [0] https://github.com/ghc/ghc/search?utf8=%E2%9C%93&q=showOptions&type= -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: (none) Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Comment (by bgamari): Replying to [comment:1 SantiM]:
Hello,
Welcome SantiM!
I'd be happy to take this issue as my first contribution to GHC.
Great; don't hesitate to ask me if you have any questions. Email (ben @well-typed.com) or IRC (bgamari on `#ghc`) are both fine.
I wanted to ask a few questions first though:
1) I didn't find tests on the 'ghc' command or the "showOptions" function[0]. Any suggestions on where to put the test for this change and how to go about it?
I think `testsuite/tests/driver/` is probably best. See [[Building/RunningTests/Adding]] for instructions on adding testcases to the testsuite.
2) We could fix this by just adding 'nub' to the showOptions, but I guess that is not good enough and we probably want to take a look at how flags are registered in DynFlags. Ideas?
I suspect the issue is that "O" is registered twice (as of 6c05b27e5bafe9f232e7014f4760335f5e3ba591), {{{#!hs ------ Optimisation flags ------------------------------------------ , make_ord_flag defGhcFlag "O" (noArgM (setOptLevel 1)) ... , make_ord_flag defGhcFlag "O" (optIntSuffixM (\mb_n -> setOptLevel (mb_n `orElse` 1))) -- If the number is missing, use 1 }}} However, I believe the former is actually redundant, being handled by the latter. Perhaps try just removing it and adding a test. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: SantiM Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ---------------------------------+-------------------------------------- Changes (by SantiM): * owner: (none) => SantiM -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: SantiM Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:B15301 Wiki Page: | ---------------------------------+-------------------------------------- Changes (by SantiM): * differential: => Phab:B15301 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: SantiM Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3461 Wiki Page: | ---------------------------------+-------------------------------------- Changes (by bgamari): * differential: Phab:B15301 => Phab:D3461 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: SantiM Type: bug | Status: new Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3461 Wiki Page: | ---------------------------------+-------------------------------------- Comment (by SantiM): Thanks for the tips Ben! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13392: ghc --show-options lists flags twice
---------------------------------+--------------------------------------
Reporter: ThreeFx | Owner: SantiM
Type: bug | Status: new
Priority: low | Milestone: ⊥
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: newcomer
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3461
Wiki Page: |
---------------------------------+--------------------------------------
Comment (by Ben Gamari

#13392: ghc --show-options lists flags twice ---------------------------------+-------------------------------------- Reporter: ThreeFx | Owner: SantiM Type: bug | Status: closed Priority: low | Milestone: ⊥ Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: newcomer Operating System: Linux | Architecture: x86_64 (amd64) Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3461 Wiki Page: | ---------------------------------+-------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: Thanks for the patch, SantiM! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13392#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC