diff --git a/.circleci/run.sh b/.circleci/run.sh index 4e2479ee578d..bd64b2e51eff 100755 --- a/.circleci/run.sh +++ b/.circleci/run.sh @@ -10,6 +10,7 @@ CIRCLE_STAGE=${CIRCLE_STAGE:-pic} CIRCLE_PROJECT_REPONAME=${CIRCLE_PROJECT_REPONAME:-dmd} BUILD="debug" DMD=dmd +OS=linux case $CIRCLE_NODE_INDEX in 0) MODEL=64 ;; @@ -111,7 +112,7 @@ coverage() # load environment for bootstrap compiler source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)" - local build_path=generated/linux/$BUILD/$MODEL + local build_path=generated/$OS/$BUILD/$MODEL local builder=generated/build dmd -g -od=generated -of=$builder compiler/src/build @@ -163,7 +164,7 @@ check_clean_git() # sanitycheck for the run_individual_tests script check_run_individual() { - local build_path=generated/linux/$BUILD/$MODEL + local build_path=generated/$OS/$BUILD/$MODEL "${build_path}/dmd" -Icompiler/test -i -run ./compiler/test/run.d "BUILD=$BUILD" "MODEL=$MODEL" compiler/test/runnable/template2962.d ./compiler/test/compilable/test14275.d } @@ -177,7 +178,7 @@ check_d_builder() rm -rf generated # just to be sure # TODO: add support for 32-bit builds ./compiler/src/build.d MODEL=64 - ./generated/linux/release/64/dmd --version | grep -v "dirty" + ./generated/$OS/release/64/dmd --version | grep -v "dirty" ./compiler/src/build.d clean deactivate } diff --git a/changelog/checkaction-context-default.dd b/changelog/checkaction-context-default.dd new file mode 100644 index 000000000000..54bfce3275ee --- /dev/null +++ b/changelog/checkaction-context-default.dd @@ -0,0 +1,15 @@ +Enhanced `assert` informations are now printed by default + +Starting from this release, DMD will now print rich informations on assert failures. +For example, the following code: +--- +void main () +{ + int a = 0, b = 42; + assert(a == b); +} +--- + +Will now print: `core.exception.AssertError@filename.d(4): 0 != 42`. +This behavior was previously accessible via the CLI switch `-checkaction=context`. +To revert to the old behavior, use `-checkaction=D`. diff --git a/compiler/src/dmd/frontend.h b/compiler/src/dmd/frontend.h index 5bf43bbef706..2de0710ae82b 100644 --- a/compiler/src/dmd/frontend.h +++ b/compiler/src/dmd/frontend.h @@ -3006,10 +3006,10 @@ enum class CHECKENABLE : uint8_t enum class CHECKACTION : uint8_t { - D = 0u, - C = 1u, - halt = 2u, - context = 3u, + context = 0u, + D = 1u, + C = 2u, + halt = 3u, }; struct Output final diff --git a/compiler/src/dmd/globals.d b/compiler/src/dmd/globals.d index 1919d9ae0ce1..43d6a60fcc9d 100644 --- a/compiler/src/dmd/globals.d +++ b/compiler/src/dmd/globals.d @@ -41,10 +41,10 @@ enum CHECKENABLE : ubyte /// What should happend when an assertion fails enum CHECKACTION : ubyte { + context, /// call D assert with the error context on failure D, /// call D assert on failure C, /// call C assert on failure halt, /// cause program halt on failure - context, /// call D assert with the error context on failure } /** @@ -175,7 +175,8 @@ extern (C++) struct Param CHECKENABLE useSwitchError = CHECKENABLE._default; // check for switches without a default CHECKENABLE boundscheck = CHECKENABLE._default; // state of -boundscheck switch - CHECKACTION checkAction = CHECKACTION.D; // action to take when bounds, asserts or switch defaults are violated + /// Action to take when bounds, asserts or switch defaults are violated + CHECKACTION checkAction = CHECKACTION.context; uint errorLimit = 20; uint errorSupplementLimit = 6; // Limit the number of supplemental messages for each error (0 means unlimited) diff --git a/compiler/src/dmd/globals.h b/compiler/src/dmd/globals.h index 84fbec6977d9..3dd4c11904f8 100644 --- a/compiler/src/dmd/globals.h +++ b/compiler/src/dmd/globals.h @@ -50,10 +50,10 @@ enum typedef unsigned char CHECKACTION; enum { + CHECKACTION_context, // call D assert with the error context on failure CHECKACTION_D, // call D assert on failure CHECKACTION_C, // call C assert on failure - CHECKACTION_halt, // cause program halt on failure - CHECKACTION_context // call D assert with the error context on failure + CHECKACTION_halt // cause program halt on failure }; enum JsonFieldFlags diff --git a/compiler/test/dshell/dll_cxx.d b/compiler/test/dshell/dll_cxx.d index 0d7ea2aea653..751eb4631693 100644 --- a/compiler/test/dshell/dll_cxx.d +++ b/compiler/test/dshell/dll_cxx.d @@ -53,7 +53,7 @@ int main() // The arguments have to be passed as an array, because run would replace '/' with '\\' otherwise. run(dllCmd); - run(`$DMD -m$MODEL -I$SRC -g -od=$OUTPUT_BASE -of=$EXE_NAME $SRC/testdll.d $SRC/cppnew.d ` ~ mainExtra); + run(`$DMD -m$MODEL -I$SRC -checkaction=D -g -od=$OUTPUT_BASE -of=$EXE_NAME $SRC/testdll.d $SRC/cppnew.d ` ~ mainExtra); run(`$EXE_NAME`, stdout, stderr, [`LD_LIBRARY_PATH`: Vars.OUTPUT_BASE]); diff --git a/compiler/test/run.d b/compiler/test/run.d index 3d1ddf883fbd..eff70224eef1 100755 --- a/compiler/test/run.d +++ b/compiler/test/run.d @@ -288,6 +288,8 @@ void ensureToolsExists(const string[string] env, const TestTool[] tools ...) // DMD compiler under test command = [ env["DMD"], + // Do not depend on linking Phobos, especially for `dshell_prebuilt` + "-checkaction=D", "-conf=", "-m"~env["MODEL"], "-of" ~ targetBin, diff --git a/compiler/test/runnable/complex.d b/compiler/test/runnable/complex.d index 50e793e21e6a..cb075662a7b8 100644 --- a/compiler/test/runnable/complex.d +++ b/compiler/test/runnable/complex.d @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -d +REQUIRED_ARGS: -d -checkaction=D TEST_OUTPUT: --- --- diff --git a/compiler/test/runnable/iasm.d b/compiler/test/runnable/iasm.d index 7021ec2f9b7b..acbdc448ea81 100644 --- a/compiler/test/runnable/iasm.d +++ b/compiler/test/runnable/iasm.d @@ -1,4 +1,5 @@ // PERMUTE_ARGS: +// REQUIRED_ARGS: -checkaction=D // Copyright (c) 1999-2016 by The D Language Foundation // All Rights Reserved diff --git a/compiler/test/runnable/iasm64.d b/compiler/test/runnable/iasm64.d index 1883c8738734..62714916399a 100644 --- a/compiler/test/runnable/iasm64.d +++ b/compiler/test/runnable/iasm64.d @@ -1,4 +1,5 @@ // PERMUTE_ARGS: +// REQUIRED_ARGS: -checkaction=D // Copyright (c) 1999-2016 by The D Language Foundation // All Rights Reserved