pbzip2 doesn't build with newer versions of clang++

Bug #1746369 reported by Rahul Chaudhry
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pbzip2
New
Undecided
Unassigned

Bug Description

With newer versions of clang++, pbzip2 build fails with [-Wreserved-user-defined-literal] errors.
Tested with pbzip2-1.1.13:
$ CXX=clang++ make
clang++ -O2 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DUSE_STACKSIZE_CUSTOMIZATION -pthread -D_POSIX_PTHREAD_SEMANTICS pbzip2.cpp BZ2StreamScanner.cpp ErrorContext.cpp -o pbzip2 -lbz2 -lpthread
pbzip2.cpp:1223:75: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
                                fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%"PRIuMAX" bytes].\n",
                                                                                                      ^

pbzip2.cpp:1832:39: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
                fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize);
                                                    ^

pbzip2.cpp:2075:39: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
                fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize);
                                                    ^

pbzip2.cpp:2797:80: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
                fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%"PRIuMAX"! Aborting...\n", (uintmax_t)size);
                                                                                             ^

pbzip2.cpp:4105:41: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
                                fprintf(stderr, " Input Size: %"PRIuMAX" bytes\n", (uintmax_t)InFileSize);
                                                                    ^

pbzip2.cpp:4227:65: error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal]
                                        fprintf(stderr, "*Warning* Max memory limit increased to %"PRIuMAX" MB to support %d CPUs\n", (uintmax_t)((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
                                                                                                   ^

6 errors generated.

Revision history for this message
Rahul Chaudhry (rahulchaudhry) wrote :
Download full text (3.3 KiB)

The build works again after applying this patch (also attached):
--- pbzip2.cpp
+++ pbzip2.cpp
@@ -1220,7 +1220,7 @@ int producer_decompress(int hInfile, OFF_T fileSize, queue *fifo)
                        // give warning to user if block is larger than 250 million bytes
                        if (fileData->bufSize > 250000000)
                        {
- fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%"PRIuMAX" bytes].\n",
+ fprintf(stderr, "pbzip2: *WARNING: Compressed block size is large [%" PRIuMAX " bytes].\n",
                                                (uintmax_t) fileData->bufSize);
                                fprintf(stderr, " If program aborts, use regular BZIP2 to decompress.\n");
                        }
@@ -1829,7 +1829,7 @@ void *fileWriter(void *outname)

        if (QuietMode != 1)
        {
- fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize);
+ fprintf(stderr, " Output Size: %" PRIuMAX " bytes\n", (uintmax_t)CompressedSize);
        }

        #ifdef PBZIP_DEBUG
@@ -2072,7 +2072,7 @@ int directcompress(int hInfile, OFF_T fileSize, int blockSize, const char *OutFi
                close(hOutfile);
        if (QuietMode != 1)
        {
- fprintf(stderr, " Output Size: %"PRIuMAX" bytes\n", (uintmax_t)CompressedSize);
+ fprintf(stderr, " Output Size: %" PRIuMAX " bytes\n", (uintmax_t)CompressedSize);
        }

        syncSetProducerDone(1); // Not really needed for direct version
@@ -2794,7 +2794,7 @@ void outputBufferInit(size_t size)
        // unlikely to get here since more likely exception will be thrown
        if (OutputBuffer.size() != size)
        {
- fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%"PRIuMAX"! Aborting...\n", (uintmax_t)size);
+ fprintf(stderr, "pbzip2: *ERROR: Could not initialize (OutputBuffer); size=%" PRIuMAX "! Aborting...\n", (uintmax_t)size);
                safe_mutex_unlock(OutMutex);
                exit(1);
        }
@@ -4102,7 +4102,7 @@ int main(int argc, char* argv[])
                        if (decompress == 1)
                                fprintf(stderr, " BWT Block Size: %c00k\n", BWTblockSizeChar);
                        if (hasInFile)
- fprintf(stderr, " Input Size: %"PRIuMAX" bytes\n", (uintmax_t)InFileSize);
+ fprintf(stderr, " Input Size: %" PRIuMAX " bytes\n", (uintmax_t)InFileSize);
                }

                if (decompress == 1)
@@ -4224,7 +4224,7 @@ int main(int argc, char* argv[])
                        {
                                NumBufferedBlocksMax = numCPU;
                                if (QuietMode != 1)
- fprintf(stderr, "*Warning* Max memory limit increased to %"PRIuMAX" MB to support %d CPUs\n", (uintmax_t)((NumBufferedBlocksMax + (numCPU * 2)) * blockSize)/1000000, numCPU);
+ fprintf(stderr, "*Warning* Max memory limit increased to %" PRIuMAX " MB t...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.