From 9f7833edf12c21e925746bc8a83068f14ae43962 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Tue, 19 May 2026 11:28:20 +0400 Subject: [PATCH] Remove GCC marning --- libplum/libplum.nim | 12 ++++++++---- libplum/plum.nim | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/libplum/libplum.nim b/libplum/libplum.nim index 4892461..cfa67f4 100644 --- a/libplum/libplum.nim +++ b/libplum/libplum.nim @@ -12,14 +12,18 @@ const rootPath = currentSourcePath.parentDir().parentDir().replace('\\', '/') libplumPath = rootPath & "/vendor/libplum" includePath = libplumPath & "/include/plum" - libraryPath = libplumPath & "/build/libplum.a" + libraryPath = libplumPath & "/libplum.a" {.passc: "-I" & includePath & " -DPLUM_STATIC".} {.passl: libraryPath.} # libplum declares some parameters as `const T*` in C (read-only pointer). # Nim has no equivalent, so the generated C code drops the `const`, causing -# a type mismatch warning in GCC 15+. This flag suppresses that warning. -# It is safe because we never write through those pointers. -{.passc: "-Wno-incompatible-pointer-types".} +# a type mismatch warning in GCC 15+. This pragma suppresses that warning +# only in this translation unit and is valid for both C and C++. +{.emit: """ +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wno-incompatible-pointer-types" +#endif +""".} when defined(windows): {.passl: "-lws2_32 -liphlpapi -lbcrypt".} diff --git a/libplum/plum.nim b/libplum/plum.nim index 702e126..f925a38 100644 --- a/libplum/plum.nim +++ b/libplum/plum.nim @@ -12,6 +12,12 @@ import chronos/threadsync import results import ./libplum +{.emit: """ +#ifdef __GNUC__ +#pragma GCC diagnostic ignored "-Wincompatible-pointer-types" +#endif +""".} + export results {.pragma: callback, cdecl, raises: [], gcsafe.}