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

830 compilation with clang #831

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Oct 6, 2024

  1. [DAPHNE-daphne-eu#830] Support compilation with Clang

    This commit enables compiling DAPHNE with Clang (tested version 18.1.3 from Ubuntu 24 LTS). Below is the collected change log of the pre-squash commits:
    
    [DAPHNE-daphne-eu#830] Fix duplicate symbol linker issue
    
    Compiling with Clang/LLD complains about duplicate symbols of supportsUnaryOp and supportsBinaryOp.
    The definition of supportsBinaryOp would need to be declared static if left i the BinaryOpCode.h header which is included in several places.
    Since this definition is not allowed and there is only one use, it is moved to its own file.
    
    [DAPHNE-daphne-eu#830] Replace lambda function using invalid C++ with local static template function
    
    std::pair<bool, auto> was used as a convenience function in DaphneDSLVisitor.cpp. According to [1] this is invalid and only works with GCC. Replacing it with a templated local function makes Clang compile it too. Further improvements to this file will be considered in future commit.
    
    [1] https://stackoverflow.com/questions/59578575/stdpairauto-auto-return-type
    
    [DAPHNE-daphne-eu#830] Fix anonymous namespace issue when compiling with Clang
    
    When compiling with clang, there is a issue at runtime (LLVM complaining about anonymous namespaces not allowed in various places). These are hereby replaced with a non-anonymous namespace. For the lack of creativity these are all called "file_local".
    
    [DAPHNE-daphne-eu#830] Fix compilation error (with clang) in json dependency
    
    The use of EOF in our json dependency makes compilation fail with Clang.
    Patch is based on nlohmannjson version 3.11.3
    
    [DAPHNE-daphne-eu#830] Silence warning when using LLD
    
    With this new CMake configuration, we silence a lot of warnings when using the LLD linker in combination with clang:
    ``clang++: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]``
    
    A CMake version bump to 3.29 is necessary for this config option. Ubuntu 24 users need to switch to the snap version of CMake. The Docker images already provide CMake 3.30
    
    [DAPHNE-daphne-eu#830] Clang option for build.sh
    
    This commit adds the convenience option to build with Clang to the build.sh script
    
    Resolves daphne-eu#830, Closes daphne-eu#831
    corepointer committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    5a16ecc View commit details
    Browse the repository at this point in the history