clMathLibraries / clSPARSE

a software library containing Sparse functions written in OpenCL
Apache License 2.0
173 stars 60 forks source link

Remove unused broken GetTypecode to allow building with GCC 8 #210

Open rebecca-palmer opened 5 years ago

rebecca-palmer commented 5 years ago

This template function is unused (not in any public headers and not called from within clSPARSE), and has always been non-instantiable (and hence unusable) as char[4] to char& is an invalid conversion.

Older GCC didn't notice as we never try (instantiating a class template only instantiates those member functions that are used), but in GCC 8 its existence is an error:

/build/clsparse-0.10.2.0/src/library/io/mm-reader.cpp: In member function 'char& MatrixMarketReader::GetTypecode()': /build/clsparse-0.10.2.0/src/library/io/mm-reader.cpp:123:16: error: invalid conversion from 'char' to 'char' [-fpermissive] return Typecode; ^~~~ /build/clsparse-0.10.2.0/src/library/io/mm-reader.cpp:123:16: error: cannot bind rvalue '(char)((char)(&((MatrixMarketReader*)this)->MatrixMarketReader::Typecode))' to 'char&'

An alternative to removal is to change the char & to char *. Both options build in Debian (gcc 8.2, clsparse 0.10.2.0, where this problem was previously reported), but have not been built in develop or tested anywhere.

rebecca-palmer commented 5 years ago

The Appveyor log looks like a missing dependency before it even got to my change - given the long period without commits, does it now also fail on unmodified develop?

Scanning dependencies of target OpenCL [ 3%] Building C object CMakeFiles/OpenCL.dir/icd.c.obj icd.c c:\projects\clsparse-otonj\bin\opencl\icd.h(53) : fatal error C1083: Cannot open include file: 'CL/cl.h': No such file or directory NMAKE : fatal error U1077: 'C:\PROGRA~2\MICROS~3.0\VC\bin\amd64\cl.exe' : return code '0x2' Stop.