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

Don't build with -warn-error +A for releases #38

Merged
merged 2 commits into from
Nov 11, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- run: opam pin add num . --no-action

# Check building with make
- run: opam exec -- make
- run: opam exec -- make PROFILE=dev
- run: opam exec -- make test
- run: opam exec -- make clean

Expand Down
26 changes: 26 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,29 @@ else
NATIVE_COMPILER = true
endif
endif

# PROFILE=dev or PROFILE=release
PROFILE ?= auto

# Assume we're in release mode if there's no .git directory (means that an old
# school installation from a tarball assumes release mode, but a Git clone
# assumes development mode)
ifeq "$(PROFILE)" "auto"
# This file is included from a sub-directory, hence the ../
ifeq "$(wildcard ../.git)" ""
PROFILE = release
else
PROFILE = dev
endif
endif

ifneq "$(filter-out release dev, $(PROFILE))$(word 2, $(PROFILE))" ""
$(error The PROFILE variable must be one of auto, dev, or release)
endif

# Only use -warn-error in dev mode
ifeq "$(PROFILE)" "dev"
WARN_ERROR = -warn-error +A
else
WARN_ERROR =
endif
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ More documentation on the functions provided in this library can be found in _Th

Prerequisites: OCaml version 4.04 or newer.
```
make all
make all PROFILE=release
make test
make install
make clean
Expand Down
16 changes: 16 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(rule (with-stdout-to warnings.sexp (echo
; Add any warnings to this string (-warn-error +A is appended for the dev
; profile)
"(-w +a-4-9-41-42-44-45-48)"
)))

(rule (with-stdout-to flags.sexp (echo
; Add any compilation flags to this string
"(-safe-string -strict-sequence -strict-formats)"
)))

(env
(dev
(flags (:include warnings.sexp) -warn-error +A (:include flags.sexp)))
(release
(flags (:include warnings.sexp) (:include flags.sexp))))
3 changes: 2 additions & 1 deletion num.opam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ homepage: "https://github.com/ocaml/num/"
bug-reports: "https://github.com/ocaml/num/issues"
dev-repo: "git+https://github.com/ocaml/num.git"
build: [
[make "opam-legacy" {!ocaml:preinstalled & ocaml:version < "5.0.0~~"}
[make "PROFILE=release"
"opam-legacy" {!ocaml:preinstalled & ocaml:version < "5.0.0~~"}
"opam-modern" {ocaml:preinstalled | ocaml:version >= "5.0.0~~"}]
[make "test"] {with-test}
]
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ else
BNG_ARCH=$(ARCH)
endif

CAMLCFLAGS=-w +a-4-9-41-42-44-45-48 -warn-error +A -bin-annot -g \
CAMLCFLAGS=-w +a-4-9-41-42-44-45-48 $(WARN_ERROR) -bin-annot -g \
-safe-string -strict-sequence -strict-formats -I +compiler-libs
CAMLOPTFLAGS=$(CAMLCFLAGS)
ifeq "$(FLAMBDA)" "true"
Expand Down
3 changes: 1 addition & 2 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
(language c)
(names nat_stubs bng)
(extra_deps (glob_files *.c))
(flags "-DBNG_ARCH_%{architecture}"))
(flags -w +a-4-9-41-42-44-45-48 -warn-error +A -g -safe-string -strict-sequence -strict-formats))
(flags "-DBNG_ARCH_%{architecture}")))
3 changes: 2 additions & 1 deletion test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
(library
(name test_lib)
(modules test test_nats test_big_ints test_ratios test_nums test_io end_test)
(libraries num))
(libraries num)
(flags ))

(executable
(name driver)
Expand Down
39 changes: 0 additions & 39 deletions toplevel/Makefile

This file was deleted.

3 changes: 1 addition & 2 deletions toplevel/dune
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
(public_name num.top)
(libraries num compiler-libs)
(wrapped false)
(modes byte)
(flags -w +a-4-9-41-42-44-45-48 -warn-error +A -safe-string -strict-sequence -strict-formats))
(modes byte))

(rule
(with-stdout-to META.shim
Expand Down
Loading