Enable the 'inline' directive based on ECCODES_HAVE_C_INLINE

This commit is contained in:
shahramn 2024-07-23 13:16:17 +01:00
parent 47258f4920
commit b3de64188b
3 changed files with 6 additions and 4 deletions

View File

@ -50,9 +50,9 @@ check_symbol_exists( fdatasync "unistd.h" ECCODES_HAVE_FDATASYNC)
check_c_source_compiles( check_c_source_compiles(
" typedef int foo_t; " typedef int foo_t;
static inline foo_t static_foo(){return 0;} static inline foo_t static_foo(void){return 0;}
foo_t foo(){return 0;} foo_t foo(void){return 0;}
int main(int argc, char *argv[]){return 0;} int main(int argc, char *argv[]){ return static_foo(); }
" ECCODES_HAVE_C_INLINE " ECCODES_HAVE_C_INLINE
) )

View File

@ -23,6 +23,8 @@
#define ECCODES_DEFINITION_PATH "@ECCODES_DEFINITION_PATH@" #define ECCODES_DEFINITION_PATH "@ECCODES_DEFINITION_PATH@"
#cmakedefine ECCODES_HAVE_C_INLINE
#ifdef ECCODES_HAVE_C_INLINE #ifdef ECCODES_HAVE_C_INLINE
#define GRIB_INLINE inline #define GRIB_INLINE inline
#endif #endif

View File

@ -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 // 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 += *bitp / 8;
*p |= (1u << (7 - ((*bitp) % 8))); *p |= (1u << (7 - ((*bitp) % 8)));