Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit a warning when -g was not passed (#268) #290

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Main.lhs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Path settings auto-generated by Cabal:
> import Happy.Tabular.Info (genInfoFile)

> import System.Console.GetOpt
> import Control.Monad ( liftM, when )
> import Control.Monad ( liftM, when, unless )
> import System.Environment
> import System.Exit (exitWith, ExitCode(..))
> import Data.Char
Expand Down Expand Up @@ -62,6 +62,11 @@ Read and parse the CLI arguments.
> where
> runParserGen cli fl_name = do

If no -g flag has been passed, show a warning.

> unless (OptGhcTarget `elem` cli) $
> hPutStrLn stderr "Warning: With happy 2.0, the --ghc flag has become non-optional. To suppress this warning, pass the --ghc flag."

Open the file.

> fl <- readFile fl_name
Expand Down
8 changes: 4 additions & 4 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ ERROR_TESTS = error001.y

# NOTE: `cabal` will set the `happy_datadir` env-var accordingly before invoking the test-suite
#TEST_HAPPY_OPTS = --strict --template=..
TEST_HAPPY_OPTS = --strict
TEST_HAPPY_OPTS = --strict -g

%.n.hs : %.y
$(HAPPY) $(TEST_HAPPY_OPTS) $< -o $@

%.n.hs : %.ly
$(HAPPY) $(TEST_HAPPY_OPTS) -c $< -o $@
$(HAPPY) $(TEST_HAPPY_OPTS) $< -o $@

%.c.hs : %.y
$(HAPPY) $(TEST_HAPPY_OPTS) $< -o $@
$(HAPPY) $(TEST_HAPPY_OPTS) -c $< -o $@

%.c.hs : %.ly
$(HAPPY) $(TEST_HAPPY_OPTS) -c $< -o $@
Expand All @@ -80,7 +80,7 @@ path.run : # simply a test to output the path of the built happy executable, use

check.%.y : %.y
@echo "--> Checking $<..."
$(HAPPY) $(TEST_HAPPY_OPTS) $< 1>$*.run.stdout 2>$*.run.stderr || true
$(HAPPY) $(TEST_HAPPY_OPTS) -g $< 1>$*.run.stdout 2>$*.run.stderr || true
sed -i '/^Up to date$$/d' $*.run.stdout $*.run.stderr
@diff -u --ignore-all-space $*.stdout $*.run.stdout
@diff -u --ignore-all-space $*.stderr $*.run.stderr
Expand Down