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

hedley pkgtest is wrong #4735

Open
3uclid3 opened this issue Jul 23, 2024 · 1 comment
Open

hedley pkgtest is wrong #4735

3uclid3 opened this issue Jul 23, 2024 · 1 comment
Labels

Comments

@3uclid3
Copy link

3uclid3 commented Jul 23, 2024

Xmake Version

2.9.3+20240723

Operating System Version and Architecture

Kubuntu 24.04

Describe Bug

The pkgtest fail if warning as error are enabled in a custom toolchains.

Expected Behavior

Test must not fail if warning as error are enabled.

The test should look like that to ensure that 'test' method does NOT return
HEDLEY_NO_RETURN void test() { std::abort(); }

Project Configuration

toolchain("xxx-clang")
set_kind("standalone")

set_toolset("as", "clang")
set_toolset("cc", "clang")
set_toolset("cxx", "clang++", "clang")

set_toolset("ld", "ld.lld", "lld")

set_toolset("ar", "llvm-ar", "ar")
set_toolset("strip", "llvm-strip", "strip")

on_check(function (toolchain)
    return import("lib.detect.find_tool")("clang")
end)

on_load(function (toolchain)
    local cx_args = {
        "-ffreestanding",
        "-fno-stack-protector",
        "-fno-omit-frame-pointer",
        "-fno-pic",
        "-fno-pie",

        "-nostdinc",
        "-msoft-float",

        -- using set_warnings causes some argument ordering issues
        "-Wall", "-Werror",

        "-Wno-error=#warnings",
        "-Wno-builtin-macro-redefined",
        "-Wno-macro-redefined",
        "-Wno-nan-infinity-disabled",
        "-Wno-frame-address"
    }
    local c_args = { }
    local cxx_args = {
        "-fno-rtti",
        "-fno-exceptions",
        "-fsized-deallocation",

        "-Wno-unused-parameter",
        "-Wno-non-virtual-dtor"
    }

    local ld_args = {
        "-nostdlib",
        "-static",
        "-znoexecstack"
    }

    local target = ""

    if is_arch("x86_64") then
        target = "x86_64-pc-elf"

        table.insert(cx_args, "-march=x86-64")
        table.insert(cx_args, "-mno-red-zone")
    elseif is_arch("aarch64") then
        target = "aarch64-elf"

        table.insert(cx_args, "-mcmodel=small")
    end

    table.insert(cx_args, "--target=" .. target)

    table.insert(c_args, get_config("extra_cflags"))
    table.insert(cxx_args, get_config("extra_cxxflags"))

    toolchain:add("cxflags", cx_args, { force = true })
    toolchain:add("cflags", c_args, { force = true })
    toolchain:add("cxxflags", cxx_args, { force = true })

    toolchain:add("ldflags", ld_args, { force = true })

    toolchain:add("includedirs",
        "$(projectdir)/include",
        "$(projectdir)/include/std",
        "$(projectdir)/include/std/stubs",
        "$(projectdir)/include/libc",
        "$(projectdir)/include/kernel",
        "$(projectdir)/include/modules"
    )
end)

toolchain_end()

-- <-- toolchain

-- dependencies -->

add_toolchains("nos-clang")

add_requires(
"hedley",
{ system = false }
)

target("nos.elf")
set_default(true)
set_kind("binary")
set_toolchains("nos-clang")
add_files("**.cpp")

Additional Information and Error Logs

=> install hedley v15 .. failed

/tmp/.xmake1000/240723/_34FB2A73DA9544B7B2BAB79D60CD9A2F.cpp:6:26: error: function declared noreturn' should not return [-Werror,-Winvalid-noreturn]
6 | void test()

@3uclid3 3uclid3 added the bug label Jul 23, 2024
@waruqi
Copy link
Member

waruqi commented Jul 24, 2024

"-Wall", "-Werror" should not be added into toolchain. please remove them and set them in target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants