[Mesa-dev] [PATCH 2/2] clover: Re-order includes in invocation.cpp to fix build

Ilia Mirkin imirkin at alum.mit.edu
Tue Jul 19 16:51:07 UTC 2016


On Tue, Jul 19, 2016 at 11:13 AM, Tom Stellard <thomas.stellard at amd.com> wrote:
> The build was failing because the official CL headers have a few defines, like:

like ...

>
> Which have the same name as some class members of clang's OpenCLOptions class.
> If we include the cl headers first, this breaks the build because the member
> names of this class are replaced by the literal 1.
> ---
>  .../state_trackers/clover/llvm/invocation.cpp      | 24 +++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/llvm/invocation.cpp b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> index 437d75e..81ace64 100644
> --- a/src/gallium/state_trackers/clover/llvm/invocation.cpp
> +++ b/src/gallium/state_trackers/clover/llvm/invocation.cpp
> @@ -24,13 +24,6 @@
>  // OTHER DEALINGS IN THE SOFTWARE.
>  //
>
> -#include "llvm/codegen.hpp"
> -#include "llvm/compat.hpp"
> -#include "llvm/invocation.hpp"
> -#include "llvm/metadata.hpp"
> -#include "llvm/util.hpp"
> -#include "util/algorithm.hpp"
> -
>  #include <llvm/IR/DiagnosticPrinter.h>
>  #include <llvm/IR/DiagnosticInfo.h>
>  #include <llvm/IR/LLVMContext.h>
> @@ -45,6 +38,23 @@
>  #include <clang/Frontend/TextDiagnosticPrinter.h>
>  #include <clang/Basic/TargetInfo.h>
>
> +// We need to include internal headers last, because the internal headers
> +// include CL headers which have #define's like:
> +//
> +//#define cl_khr_gl_sharing 1
> +//#define cl_khr_icd 1
> +//
> +// Which will break the compilation of clang/Basic/OpenCLOptions.h
> +
> +#include "core/error.hpp"
> +#include "llvm/codegen.hpp"
> +#include "llvm/compat.hpp"
> +#include "llvm/invocation.hpp"
> +#include "llvm/metadata.hpp"
> +#include "llvm/util.hpp"
> +#include "util/algorithm.hpp"
> +
> +
>  using namespace clover;
>  using namespace clover::llvm;
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list