From b3de64188be0bedd7bd7bcc9cfe70a13b4f478c0 Mon Sep 17 00:00:00 2001 From: shahramn Date: Tue, 23 Jul 2024 13:16:17 +0100 Subject: [PATCH] Enable the 'inline' directive based on ECCODES_HAVE_C_INLINE --- CMakeLists.txt | 6 +++--- eccodes_config.h.in | 2 ++ src/accessor/grib_accessor_class_g2bitmap.cc | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a4c05cd7..062da488a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,9 +50,9 @@ check_symbol_exists( fdatasync "unistd.h" ECCODES_HAVE_FDATASYNC) check_c_source_compiles( " typedef int foo_t; - static inline foo_t static_foo(){return 0;} - foo_t foo(){return 0;} - int main(int argc, char *argv[]){return 0;} + static inline foo_t static_foo(void){return 0;} + foo_t foo(void){return 0;} + int main(int argc, char *argv[]){ return static_foo(); } " ECCODES_HAVE_C_INLINE ) diff --git a/eccodes_config.h.in b/eccodes_config.h.in index 2278151b0..4432f9a10 100644 --- a/eccodes_config.h.in +++ b/eccodes_config.h.in @@ -23,6 +23,8 @@ #define ECCODES_DEFINITION_PATH "@ECCODES_DEFINITION_PATH@" +#cmakedefine ECCODES_HAVE_C_INLINE + #ifdef ECCODES_HAVE_C_INLINE #define GRIB_INLINE inline #endif diff --git a/src/accessor/grib_accessor_class_g2bitmap.cc b/src/accessor/grib_accessor_class_g2bitmap.cc index e50741d55..7b1783d9a 100644 --- a/src/accessor/grib_accessor_class_g2bitmap.cc +++ b/src/accessor/grib_accessor_class_g2bitmap.cc @@ -24,7 +24,7 @@ void grib_accessor_class_g2bitmap_t::init(grib_accessor* a, const long len, grib } // For speed use a local static function -static void set_bit_on(unsigned char* p, long* bitp) +static GRIB_INLINE void set_bit_on(unsigned char* p, long* bitp) { p += *bitp / 8; *p |= (1u << (7 - ((*bitp) % 8)));