From f57be5c5f9ef1472232d0f2a8aca41268fc3bf57 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 25 Jul 2019 02:13:50 +0700 Subject: [PATCH] Error when stub names are relative paths Previously, these would be ignored with a warning. Signed-off-by: Rudi Grinberg --- src/c_sources.ml | 9 +++++---- test/blackbox-tests/test-cases/github734/run.t | 7 ++----- test/blackbox-tests/test-cases/multi-dir/run.t | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/c_sources.ml b/src/c_sources.ml index a9cf9f4972a9..f6ac126dde40 100644 --- a/src/c_sources.ml +++ b/src/c_sources.ml @@ -68,10 +68,11 @@ let make (d : _ Dir_with_dune.t) let s = validate ~loc s in let s' = Filename.basename s in if s' <> s then begin - (* DUNE2: make this an error *) - User_warning.emit ~loc - [ Pp.text "relative part of stub are no longer \ - necessary and are ignored." + User_error.raise ~loc + [ Pp.text + "relative part of stub is not necessary and should be \ + removed. To include sources in subdirectories, \ + use the include_subdirs stanza" ] end; s' diff --git a/test/blackbox-tests/test-cases/github734/run.t b/test/blackbox-tests/test-cases/github734/run.t index 46a0e1285aa8..2546d08ee10c 100644 --- a/test/blackbox-tests/test-cases/github734/run.t +++ b/test/blackbox-tests/test-cases/github734/run.t @@ -2,9 +2,6 @@ File "src/dune", line 4, characters 10-17: 4 | (c_names stubs/x)) ^^^^^^^ - Warning: relative part of stub are no longer necessary and are ignored. - File "src/dune", line 4, characters 10-17: - 4 | (c_names stubs/x)) - ^^^^^^^ - Error: x does not exist as a C source. x.c must be present + Error: relative part of stub is not necessary and should be removed. To + include sources in subdirectories, use the include_subdirs stanza [1] diff --git a/test/blackbox-tests/test-cases/multi-dir/run.t b/test/blackbox-tests/test-cases/multi-dir/run.t index 84ce37917c91..01da88b4d389 100644 --- a/test/blackbox-tests/test-cases/multi-dir/run.t +++ b/test/blackbox-tests/test-cases/multi-dir/run.t @@ -22,9 +22,9 @@ Test with C stubs in sub-directories File "dune", line 9, characters 16-25: 9 | (c_names stub1 sub/stub2)) ^^^^^^^^^ - Warning: relative part of stub are no longer necessary and are ignored. - main alias runtest - Hello, world! + Error: relative part of stub is not necessary and should be removed. To + include sources in subdirectories, use the include_subdirs stanza + [1] Test some error cases ---------------------