Skip to content

Commit

Permalink
Relocate llvm-version.h in codegen to avoid a warning (#43181)
Browse files Browse the repository at this point in the history
Our `llvm-version.h` defines `LLVM_ENABLE_STATS` if it's not already
defined. However, we're `#include`ing that file in `codegen.cpp` before
we `#include` the LLVM headers that define it. That means it gets
defined twice, triggering a `-Wmacro-redefined` warning. If we move the
inclusion of our file to below the inclusion of LLVM's headers, we just
use their definition and avoid a warning.
  • Loading branch information
ararslan authored Nov 22, 2021
1 parent b078d77 commit a0c920c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// This file is a part of Julia. License is MIT: https://julialang.org/license

#include "llvm-version.h"
#include "platform.h"
#if defined(_OS_WINDOWS_)
// use ELF because RuntimeDyld COFF i686 support didn't exist
Expand Down Expand Up @@ -64,6 +63,9 @@
#include <llvm/IR/PassTimingInfo.h>
#include <llvm/Bitcode/BitcodeWriter.h>

// Included after LLVM support to avoid redefinition warnings
#include "llvm-version.h"

// C API
#include <llvm-c/Types.h>

Expand Down

0 comments on commit a0c920c

Please sign in to comment.