Skip to content

Conversation

@coin-au-carre
Copy link

…via push pop

martinmoene added a commit that referenced this pull request Oct 24, 2015
suppress several warnings and save/restore compiler state
@martinmoene martinmoene merged commit 7258872 into martinmoene:master Oct 24, 2015
@martinmoene martinmoene mentioned this pull request Oct 24, 2015
@mazunki
Copy link
Contributor

mazunki commented Oct 22, 2025

Is this actually resolved?

Suggest braces around initialization of subobject (fix available) inside the CASE(...) statement here:

const lest::test specification[] = {
    CASE("mappings must be either MAP_PRIVATE xor MAP_SHARED") {
        SETUP("") {
            SECTION("neither specified must fail") {

This silences the warning:

#pragma clang diagnostic ignored "-Wmissing-braces"
#include "lest/lest.hpp"

Also, related question: Is there a better way than an empty SETUP("") to create subcases despite not actually having any actual setup?

@martinmoene
Copy link
Owner

martinmoene commented Oct 25, 2025

Thanks @mazunki .

It is not possible to use subcases without the Setup(...) as it is required for visiting the subcases.

Another way to avoid warnings from lest with gcc and clang is to include its folder as a system folder, like -isystem lest.

I have to take a closer look at your question 'Is this actually resolved?'. Reproduced on Compiler Explorer, but solved now (25-Oct-2025, 17.45).

@mazunki
Copy link
Contributor

mazunki commented Oct 26, 2025

It is not possible to use subcases without the Setup(...) as it is required for visiting the subcases.

Makes sense, I figured. Thanks!

I have to take a closer look at your question 'Is this actually resolved?'

No warnings at f602900 for me anymore, but I'll be happy to let you know if I see any. Could we expect a tagged release for this, or do you prefer a less frequent interval of releases?

Either way, appreciate it :)

Another way to avoid warnings from lest with gcc and clang is to include its folder as a system folder, like -isystem lest.

Thanks for the advice, but just tried it and it's not helping. I also tried #include <lest/lest.hpp> vs #include "lest/lest.hpp with both -I and -isystem. For some reason clangd seems to want to inject it as -I despite -isystem already being in the compile_commands database for this entry (which is the one it picks for the corresponding test file which doesn't have an entry):

$ grep src/kernel/service_stub.cpp compile_commands.json       
    "command": "/nix/store/lk9yfcvpmwmxq1ywscp6hfwfah3iykl1-clang-wrapper-static-19.1.7/bin/clang++ --target=x86_64-pc-linux-elf -DARCH=\\\"x86_64\\\" -DARCH_x86_64 -DINCLUDEOS_SMP_ENABLE -I/home/maz/repos/includeos/IncludeOS/src/../api -I/home/maz/repos/includeos/IncludeOS/src/include -I/home/maz/repos/includeos/IncludeOS/lib/LiveUpdate/include   -g -fstack-protector-strong -DNO_DEBUG=1 -DOS_TERMINATE_ON_CONTRACT_VIOLATION -D_GNU_SOURCE -D__includeos__ -m64 -Wall -Wextra -Wno-frame-address -nostdlib -nostdlibinc -fno-omit-frame-pointer -c -fno-threadsafe-statics -std=c++20 -o CMakeFiles/kernel.dir/service_stub.cpp.o -c /home/maz/repos/includeos/IncludeOS/src/kernel/service_stub.cpp -isystem /nix/store/jh2plnzs5vib0007vdl8ywv8zq06r41q-libcxx-static-x86_64-unknown-linux-musl-19.1.7-dev/include/c++/v1 -isystem /nix/store/8wk82sx9hf61s73ynphpsfas0g57xsl7-musl-includeos-static-x86_64-unknown-linux-musl-1.2.5/include  -isystem /home/maz/repos/includeos/IncludeOS/test/lest_util -isystem /nix/store/jgvhhpp33hqmyl7scw2hcpdmpf51chap-botan-static-x86_64-unknown-linux-musl-2.19.5-dev/include/botan-2 -isystem /nix/store/5ypmvcby2qrli5yffd8bd913p0d40qad-http-parser-static-x86_64-unknown-linux-musl-2.9.4/include -isystem /nix/store/mz16f93dhy508ww31awfj2dw9dclgfn0-lest-static-x86_64-unknown-linux-musl-1.36.0/include -isystem /nix/store/y34rc7g4wyqhwafyj4kjmgxazdkb0cax-libfdt-static-x86_64-unknown-linux-musl-1.7.2-dev/include/fdt -isystem /nix/store/hvb82xs7isa5r3k9viay58c24rwjdzzn-uzlib-static-x86_64-unknown-linux-musl-2.1.1/include -isystem /nix/store/249k61k4hw3v5qin4wvamzx814bq8gas-rapidjson-unstable-2024-04-09/include -isystem /nix/store/rjzx8v679rwd6dsb6s08iy3j2rrax72s-openssl-3.4.1-bin/include",
    "file": "/home/maz/repos/includeos/IncludeOS/src/kernel/service_stub.cpp",

$ env -i PATH="$PATH" clangd --check=src/kernel/service_stub.cpp 
env -i PATH="$PATH" clangd --check=src/kernel/service_stub.cpp                                                                                                                                     
I[21:21:41.391] clangd version 21.1.2
I[21:21:41.391] Features: linux
I[21:21:41.391] PID: 32354
I[21:21:41.391] Working directory: /home/maz/repos/includeos/IncludeOS
I[21:21:41.391] argv[0]: clangd
I[21:21:41.391] argv[1]: --check=src/kernel/service_stub.cpp
I[21:21:41.391] Entering check mode (no LSP server)
I[21:21:41.391] Testing on source file /home/maz/repos/includeos/IncludeOS/src/kernel/service_stub.cpp
I[21:21:41.391] Loading config file at /home/maz/repos/includeos/IncludeOS/.clangd
I[21:21:41.391] Loading compilation database...
I[21:21:41.393] Loaded compilation database from /home/maz/repos/includeos/IncludeOS/compile_commands.json
I[21:21:41.393] Compile command from CDB is: [/home/maz/repos/includeos/IncludeOS/build/src/kernel] /nix/store/lk9yfcvpmwmxq1ywscp6hfwfah3iykl1-clang-wrapper-static-19.1.7/bin/clang++ --driver-mode=g++ --target=x86_64-pc-linux-elf "-DARCH=\"x86_64\"" -DARCH_x86_64 -DINCLUDEOS_SMP_ENABLE -I/home/maz/repos/includeos/IncludeOS/src/../api -I/home/maz/repos/includeos/IncludeOS/src/include -I/home/maz/repos/includeos/IncludeOS/lib/LiveUpdate/include -g -fstack-protector-strong -DNO_DEBUG=1 -DOS_TERMINATE_ON_CONTRACT_VIOLATION -D_GNU_SOURCE -D__includeos__ -m64 -Wall -Wextra -Wno-frame-address -nostdlib -nostdlibinc -fno-omit-frame-pointer -c -fno-threadsafe-statics -std=c++20 -o CMakeFiles/kernel.dir/service_stub.cpp.o -c -isystem /nix/store/jh2plnzs5vib0007vdl8ywv8zq06r41q-libcxx-static-x86_64-unknown-linux-musl-19.1.7-dev/include/c++/v1 -isystem /nix/store/8wk82sx9hf61s73ynphpsfas0g57xsl7-musl-includeos-static-x86_64-unknown-linux-musl-1.2.5/include -isystem /home/maz/repos/includeos/IncludeOS/test/lest_util -isystem /nix/store/jgvhhpp33hqmyl7scw2hcpdmpf51chap-botan-static-x86_64-unknown-linux-musl-2.19.5-dev/include/botan-2 -isystem /nix/store/5ypmvcby2qrli5yffd8bd913p0d40qad-http-parser-static-x86_64-unknown-linux-musl-2.9.4/include -isystem /nix/store/mz16f93dhy508ww31awfj2dw9dclgfn0-lest-static-x86_64-unknown-linux-musl-1.36.0/include -isystem /nix/store/y34rc7g4wyqhwafyj4kjmgxazdkb0cax-libfdt-static-x86_64-unknown-linux-musl-1.7.2-dev/include/fdt -isystem /nix/store/hvb82xs7isa5r3k9viay58c24rwjdzzn-uzlib-static-x86_64-unknown-linux-musl-2.1.1/include -isystem /nix/store/249k61k4hw3v5qin4wvamzx814bq8gas-rapidjson-unstable-2024-04-09/include -isystem /nix/store/rjzx8v679rwd6dsb6s08iy3j2rrax72s-openssl-3.4.1-bin/include -I[/nix/store/kgb694bhlfpri4793m26w3gvbk2j59j1-lest-static-x86_64-unknown-linux-musl-1.36.0/include] -resource-dir=/usr/lib/llvm/21/bin/../../../../lib/clang/21 -- /home/maz/repos/includeos/IncludeOS/src/kernel/service_stub.cpp
I[21:21:41.393] Parsing command...
I[21:21:41.394] internal (cc1) args are: -cc1 -triple x86_64-pc-linux-elf -fsyntax-only -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name service_stub.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=5 -debugger-tuning=gdb -fdebug-compilation-dir=/home/maz/repos/includeos/IncludeOS/build/src/kernel -fcoverage-compilation-dir=/home/maz/repos/includeos/IncludeOS/build/src/kernel -nostdsysteminc -resource-dir /usr/lib/llvm/21/bin/../../../../lib/clang/21 -isystem /nix/store/jh2plnzs5vib0007vdl8ywv8zq06r41q-libcxx-static-x86_64-unknown-linux-musl-19.1.7-dev/include/c++/v1 -isystem /nix/store/8wk82sx9hf61s73ynphpsfas0g57xsl7-musl-includeos-static-x86_64-unknown-linux-musl-1.2.5/include -isystem /home/maz/repos/includeos/IncludeOS/test/lest_util -isystem /nix/store/jgvhhpp33hqmyl7scw2hcpdmpf51chap-botan-static-x86_64-unknown-linux-musl-2.19.5-dev/include/botan-2 -isystem /nix/store/5ypmvcby2qrli5yffd8bd913p0d40qad-http-parser-static-x86_64-unknown-linux-musl-2.9.4/include -isystem /nix/store/mz16f93dhy508ww31awfj2dw9dclgfn0-lest-static-x86_64-unknown-linux-musl-1.36.0/include -isystem /nix/store/y34rc7g4wyqhwafyj4kjmgxazdkb0cax-libfdt-static-x86_64-unknown-linux-musl-1.7.2-dev/include/fdt -isystem /nix/store/hvb82xs7isa5r3k9viay58c24rwjdzzn-uzlib-static-x86_64-unknown-linux-musl-2.1.1/include -isystem /nix/store/249k61k4hw3v5qin4wvamzx814bq8gas-rapidjson-unstable-2024-04-09/include -isystem /nix/store/rjzx8v679rwd6dsb6s08iy3j2rrax72s-openssl-3.4.1-bin/include -D "ARCH=\"x86_64\"" -D ARCH_x86_64 -D INCLUDEOS_SMP_ENABLE -I /home/maz/repos/includeos/IncludeOS/src/../api -I /home/maz/repos/includeos/IncludeOS/src/include -I /home/maz/repos/includeos/IncludeOS/lib/LiveUpdate/include -D NO_DEBUG=1 -D OS_TERMINATE_ON_CONTRACT_VIOLATION -D _GNU_SOURCE -D __includeos__ -I [/nix/store/kgb694bhlfpri4793m26w3gvbk2j59j1-lest-static-x86_64-unknown-linux-musl-1.36.0/include] -internal-isystem /usr/lib/llvm/21/bin/../../../../lib/clang/21/include -Wall -Wextra -Wno-frame-address -std=c++20 -fdeprecated-macro -ferror-limit 19 -fmessage-length=280 -stack-protector 2 -fgnuc-version=4.2.1 -fno-threadsafe-statics -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -no-round-trip-args -D__GCC_HAVE_DWARF2_CFI_ASM=1 -x c++ /home/maz/repos/includeos/IncludeOS/src/kernel/service_stub.cpp
I[21:21:41.394] Building preamble...
I[21:21:42.330] Built preamble of size 16922588 for file /home/maz/repos/includeos/IncludeOS/src/kernel/service_stub.cpp version null in 0.94 seconds
I[21:21:42.330] Indexing headers...
I[21:21:42.450] Building AST...
I[21:21:42.471] Indexing AST...
I[21:21:42.471] Building inlay hints
I[21:21:42.471] Building semantic highlighting
I[21:21:42.471] Testing features at each token (may be slow in large files)
I[21:21:42.484] Found definition heuristically using nearby identifier main
I[21:21:42.484] Found definition heuristically using nearby identifier main
E[21:21:42.499]     tweak: ExtractFunction ==> FAIL: Cannot extract break/continue without corresponding loop/switch statement.
E[21:21:42.503]     tweak: ExtractFunction ==> FAIL: Cannot extract break/continue without corresponding loop/switch statement.
I[21:21:42.510] All checks completed, 2 errors

I even tried to add #pragma clang system_header to both paths there (for some reason the inferred one doesn't match the explicit one; the LSP does send me to the explicit one), which also didn't silence it. Either way, this is probably an issue on either nix or our own end and not lest.

@martinmoene
Copy link
Owner

Thanks for your extensive covering of -isystem.

Nice to see interest in this project and get contributions.

I'll create a new release, v1.37.0.

@martinmoene
Copy link
Owner

Released v1.37.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants