[PATCH] D76654: [mlir] On Windows, silence warning on functions definition
Alexandre Ganea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 23 17:26:47 PDT 2020
aganea created this revision.
aganea added a reviewer: nicolasvasilache.
Herald added subscribers: llvm-commits, Joonsoo, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
This fixes the following warnings, where a function is re-defined after it is tagged as "being imported":
D:\llvm-project\mlir\lib\ExecutionEngine\CRunnerUtils.cpp(24,17): warning: 'print_i32' redeclared without 'dllimport' attribute: 'dllexport' attribute added [-Winconsistent-dllimport]
extern "C" void print_i32(int32_t i) { fprintf(stdout, "%" PRId32, i); }
^
D:\llvm-project\mlir\include\mlir/ExecutionEngine/CRunnerUtils.h(168,42): note: previous declaration is here
extern "C" MLIR_CRUNNERUTILS_EXPORT void print_i32(int32_t i);
^
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D76654
Files:
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
mlir/lib/ExecutionEngine/CRunnerUtils.cpp
Index: mlir/lib/ExecutionEngine/CRunnerUtils.cpp
===================================================================
--- mlir/lib/ExecutionEngine/CRunnerUtils.cpp
+++ mlir/lib/ExecutionEngine/CRunnerUtils.cpp
@@ -17,7 +17,9 @@
#include <cinttypes>
#include <cstdio>
-// Small runtime support "lib" for vector.print lowering.
+#ifdef MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS
+
+ // Small runtime support "lib" for vector.print lowering.
// By providing elementary printing methods only, this
// library can remain fully unaware of low-level implementation
// details of our vectors. Also useful for direct LLVM IR output.
@@ -29,3 +31,5 @@
extern "C" void print_close() { fputs(" )", stdout); }
extern "C" void print_comma() { fputs(", ", stdout); }
extern "C" void print_newline() { fputc('\n', stdout); }
+
+#endif
\ No newline at end of file
Index: mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
===================================================================
--- mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
+++ mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
@@ -20,6 +20,7 @@
#ifdef mlir_c_runner_utils_EXPORTS
/* We are building this library */
#define MLIR_CRUNNERUTILS_EXPORT __declspec(dllexport)
+#define MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS
#else
/* We are using this library */
#define MLIR_CRUNNERUTILS_EXPORT __declspec(dllimport)
@@ -27,6 +28,7 @@
#endif // MLIR_CRUNNERUTILS_EXPORT
#else
#define MLIR_CRUNNERUTILS_EXPORT
+#define MLIR_CRUNNERUTILS_DEFINE_FUNCTIONS
#endif // _WIN32
#include <cstdint>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76654.252180.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200324/5f95cda1/attachment.bin>
More information about the llvm-commits
mailing list