apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59057] New: APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers
Date Wed, 24 Feb 2016 00:48:47 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

            Bug ID: 59057
           Summary: APR_VERSION_STRING_CSV from apr_version.h is malformed
                    and fails compilation with some compilers
           Product: APR
           Version: HEAD
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: vitaly.krugl.web@gmail.com

APR_VERSION_STRING_CSV definition is malformed in apr HEAD and as far back as
v1.5.1. I discovered this while attempting to build a win32 version using the
mingwpy (gcc-based) toolchain. Some compilers (e.g., clang on macosx) don't
fail until you actually reference the malformed definition, which is how I am
guessing this malformed constant passed your builds. However, other compilers
(e.g., in mingwpy toolchain) choke on it.

To reproduce, try compiling the following code sample, first as is to see how
the HEAD version of the macro breaks; then comment out the first
APR_VERSION_STRING_CSV definition and uncomment the second definition to see
how the one from apr v1.5.1 breaks.

```c
#define APR_MAJOR_VERSION 2
#define APR_MINOR_VERSION 0
#define APR_PATCH_VERSION 0

# From apr 2.0.0
#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION, \
                               APR_MINOR_VERSION, \
                               APR_PATCH_VERSION


# From apr 1.5.1; was also malformed
//#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
//                               ##APR_MINOR_VERSION ##, \
//                               ##APR_PATCH_VERSION


int main() {
    char* version = APR_VERSION_STRING_CSV;
    return 0;
}
```

The error that I got while building apr with the mingwpy toolchain was the
following:

[ 97%] Building RC object CMakeFiles/libapr-1.dir/libapr.rc.obj
C:\mingwpy\bin\windres.exe  -O coff -DAPR_DECLARE_EXPORT -DWINNT
-Dlibapr_1_EXPORTS -IC:\Users\Administrator\nta\nupic.c
ore\build\apr\build -IC:\Users\Administrator\nta\nupic.core\build\apr\include
-IC:\Users\Administrator\nta\nupic.core\bu
ild\apr\include\arch\win32
-IC:\Users\Administrator\nta\nupic.core\build\apr\include\arch\unix
-IC:\Users\Administrator\
nta\nupic.core\build\apr\include\private  
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc CMakeFiles\libapr-1
.dir\libapr.rc.obj
In file included from
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:1:0:
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:117:32:
error: pasting "APR_MAJOR_VERSION" and ","
 does not give a valid preprocessing token
 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
                                ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:21:14: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  FILEVERSION APR_VERSION_STRING_CSV,0
              ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:117:52:
error: pasting "," and "APR_MINOR_VERSION"
 does not give a valid preprocessing token
 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
                                                    ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:21:14: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  FILEVERSION APR_VERSION_STRING_CSV,0
              ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:118:32:
error: pasting "APR_MINOR_VERSION" and ","
 does not give a valid preprocessing token
                              ##APR_MINOR_VERSION ##, \
                                ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:21:14: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  FILEVERSION APR_VERSION_STRING_CSV,0
              ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:118:52:
error: pasting "," and "APR_PATCH_VERSION"
 does not give a valid preprocessing token
                              ##APR_MINOR_VERSION ##, \
                                                    ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:21:14: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  FILEVERSION APR_VERSION_STRING_CSV,0
              ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:117:32:
error: pasting "APR_MAJOR_VERSION" and ","
 does not give a valid preprocessing token
 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
                                ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:22:17: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  PRODUCTVERSION APR_VERSION_STRING_CSV,0
                 ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:117:52:
error: pasting "," and "APR_MINOR_VERSION"
 does not give a valid preprocessing token
 #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
                                                    ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:22:17: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  PRODUCTVERSION APR_VERSION_STRING_CSV,0
                 ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:118:32:
error: pasting "APR_MINOR_VERSION" and ","
 does not give a valid preprocessing token
                              ##APR_MINOR_VERSION ##, \
                                ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:22:17: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  PRODUCTVERSION APR_VERSION_STRING_CSV,0
                 ^
C:\Users\Administrator\nta\nupic.core\build\apr\include/apr_version.h:118:52:
error: pasting "," and "APR_PATCH_VERSION"
 does not give a valid preprocessing token
                              ##APR_MINOR_VERSION ##, \
                                                    ^
C:\Users\Administrator\nta\nupic.core\build\apr\libapr.rc:22:17: note: in
expansion of macro 'APR_VERSION_STRING_CSV'
  PRODUCTVERSION APR_VERSION_STRING_CSV,0
                 ^
C:\mingwpy\bin\windres.exe: preprocessing failed.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message