Skip to content

master does not compile from cc() #7042

@jangorecki

Description

@jangorecki

We should add a test to CI that code compiles from cc()

cc()
/home/jan/git/data.table/src 
Running command:
MAKEFLAGS='-j CC=gcc CFLAGS=-fopenmp\ -std=c11\ -O3\ -pipe\ -Wall\ -pedantic\ -Wstrict-prototypes\ -isystem\ /usr/share/R/include\ \ -fno-common' R CMD SHLIB -o data_table.so *.c
using C compiler: ‘gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)’
gcc -I"/usr/include/R" -DNDEBUG   -I/usr/local/include    -fpic  -fopenmp -std=c11 -O3 -pipe -Wall -pedantic -Wstrict-prototypes -isystem /usr/share/R/include  -fno-common -c fread.c -o fread.o
In file included from /usr/include/R/R.h:70,
                 from freadR.h:6,
                 from fread.h:12,
                 from fread.c:1:
/usr/include/R/R_ext/Boolean.h:65:16: warning: ISO C does not support specifying ‘enum’ underlying types before C23 [-Wpedantic]
   65 |   typedef enum :int { FALSE = 0, TRUE } Rboolean;  // so NOT NA
      |                ^
fread.c: In function ‘copyFile’:
fread.c:120:37: error: implicit declaration of function ‘typeof’ [-Wimplicit-function-declaration]
  120 | #define OFFSET_POINTER(x, offset) ((typeof(x))((char*)x + (offset)))
      |                                     ^~~~~~
fread.c:454:17: note: in expansion of macro ‘OFFSET_POINTER’
  454 |   eof = (char *)OFFSET_POINTER(mmp_copy, fileSize);
      |                 ^~~~~~~~~~~~~~
fread.c:120:37: error: called object is not a function or function pointer
  120 | #define OFFSET_POINTER(x, offset) ((typeof(x))((char*)x + (offset)))
      |                                    ~^~~~~~~~~~
fread.c:454:17: note: in expansion of macro ‘OFFSET_POINTER’
  454 |   eof = (char *)OFFSET_POINTER(mmp_copy, fileSize);
      |                 ^~~~~~~~~~~~~~
fread.c: In function ‘freadMain’:
fread.c:120:37: error: called object is not a function or function pointer
  120 | #define OFFSET_POINTER(x, offset) ((typeof(x))((char*)x + (offset)))
      |                                    ~^~~~~~~~~~
fread.c:2411:31: note: in expansion of macro ‘OFFSET_POINTER’
 2411 |             fctx.targets[8] = OFFSET_POINTER(ctx.buff8, myNrow * rowSize8);
      |                               ^~~~~~~~~~~~~~
fread.c:120:37: error: called object is not a function or function pointer
  120 | #define OFFSET_POINTER(x, offset) ((typeof(x))((char*)x + (offset)))
      |                                    ~^~~~~~~~~~
fread.c:2412:31: note: in expansion of macro ‘OFFSET_POINTER’
 2412 |             fctx.targets[4] = OFFSET_POINTER(ctx.buff4, myNrow * rowSize4);
      |                               ^~~~~~~~~~~~~~
fread.c:120:37: error: called object is not a function or function pointer
  120 | #define OFFSET_POINTER(x, offset) ((typeof(x))((char*)x + (offset)))
      |                                    ~^~~~~~~~~~
fread.c:2413:31: note: in expansion of macro ‘OFFSET_POINTER’
 2413 |             fctx.targets[1] = OFFSET_POINTER(ctx.buff1, myNrow * rowSize1);
      |                               ^~~~~~~~~~~~~~
make: *** [/usr/lib64/R/etc/Makeconf:202: fread.o] Error 1
NULL
R version 4.5.0 (2025-04-11)
Platform: x86_64-redhat-linux-gnu
Running under: Fedora Linux 42 (Workstation Edition)

Matrix products: default
BLAS/LAPACK: FlexiBLAS OPENBLAS-OPENMP;  LAPACK version 3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.5.0 tools_4.5.0   

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions