torognes / swarm

A robust and fast clustering method for amplicon-based studies
GNU Affero General Public License v3.0
123 stars 23 forks source link

Compilation with GCC 6 fails #84

Closed frederic-mahe closed 8 years ago

frederic-mahe commented 8 years ago

GCC 6 has new warnings, including -Wmisleading-indentation.

gcc --version
gcc (GCC) 6.1.1 20160621 (Red Hat 6.1.1-3)
make
g++ -Wall -Wsign-compare -O3 -msse2 -mtune=core2 -Icityhash -g -c -o swarm.o swarm.cc
g++ -Wall -Wsign-compare -O3 -msse2 -mtune=core2 -Icityhash -g -c -o db.o db.cc
g++ -Wall -Wsign-compare -O3 -msse2 -mtune=core2 -Icityhash -g -c -o search8.o search8.cc
search8.cc: In function ‘void donormal8(__m128i*, __m128i*, __m128i**, __m128i*, __m128i*, long int, __m128i*, __m128i*, long unsigned int*, __m128i*)’:
search8.cc:446:24: error: inconsistent user-defined literal suffixes ‘V’ and ‘H’ in string literal
   "        paddusb   "V", "H"              \n"  \
                        ^
search8.cc:495:6: note: in expansion of macro ‘ONESTEP’
      ONESTEP("%%xmm0",  "%%xmm9",         "%%xmm4", " 0(%%rax)", " 0(%8,%%r11,4)")
      ^~~~~~~
search8.cc:542:6: error: unable to find string literal operator ‘operator""V’ with ‘const char [13645]’, ‘long unsigned int’ arguments
      "        movdqa    %%xmm4, (%%rax)         \n"
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
search8.cc: In function ‘void domasked8(__m128i*, __m128i*, __m128i**, __m128i*, __m128i*, long int, __m128i*, __m128i*, long unsigned int*, __m128i*, __m128i*, __m128i*, __m128i*)’:
search8.cc:446:24: error: inconsistent user-defined literal suffixes ‘V’ and ‘H’ in string literal
   "        paddusb   "V", "H"              \n"  \
                        ^
search8.cc:590:6: note: in expansion of macro ‘ONESTEP’
      ONESTEP("%%xmm0",  "%%xmm9",         "%%xmm4", " 0(%%rax)", " 0(%8,%%r11,4)")
      ^~~~~~~
search8.cc:650:6: error: unable to find string literal operator ‘operator""V’ with ‘const char [14516]’, ‘long unsigned int’ arguments
      "        movdqa    %%xmm4, (%%rax)          \n"
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [search8.o] Error 1

While reading about user-defined literals, I found that Debian packagers spotted the same problem.

GNU.org has a page on porting to GCC 6:

Invalid literal suffixes

The C++11 "user-defined literals" feature allows custom suffixes to be added to literals, so that for example "Hello, world!"s creates a std::string object. This means that code relying on string concatenation of string literals and macros might fail to compile, for example using printf("%"PRIu64, uint64_value) is not valid in C++11, because PRIu64 is parsed as a literal suffix. To fix the code to compile in C++11 add whitespace between the string literal and the macro: printf("%" PRIu64, uint64_value).

torognes commented 8 years ago

I'll fix this and recompile with GCC 6 shortly.

torognes commented 8 years ago

Fixed in version 2.1.9.