You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2016/02/24 01:48:47 UTC

[Bug 59057] New: APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

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


[Bug 59057] APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

vitaly.krugl.web@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|All                         |Windows Server 2008

-- 
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


[Bug 59057] APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

vitaly.krugl.web@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |Windows Server 2008

-- 
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


[Bug 59057] APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

vitaly.krugl.web@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #3 from vitaly.krugl.web@gmail.com ---
Ignore my earlier comment about "It should have been defined similarly to
APR_VERSION_STRING (using APR_STRINGIFY and quotes around punctuation), but
with commas instead of periods."

I see what's going on here, and it's a catch-22 situation given how the *OLDER*
apr_version.h and libapr.rc were implemented:


First, apr_version.h in apr v1.5.1 contains a definition considered malformed
by the gcc toolchain (mingwpy in particular):

#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
                               ##APR_MINOR_VERSION ##, \
                               ##APR_PATCH_VERSION

So, the gcc compiler chokes on it. this was intended to produce the equivalent
of

#define APR_VERSION_STRING_CSV 1,5,1

which libapr.rc relies on here:

FILEVERSION APR_VERSION_STRING_CSV,0
PRODUCTVERSION APR_VERSION_STRING_CSV,0




The ones in HEAD should be okay, though, since APR_VERSION_STRING_CSV has been
redefined as the following, which passes the mingwpy build:

#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION, \
                               APR_MINOR_VERSION, \
                               APR_PATCH_VERSION

-- 
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


[Bug 59057] APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

vitaly.krugl.web@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|All                         |Windows Server 2008 R2

-- 
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


[Bug 59057] APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

vitaly.krugl.web@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #2 from vitaly.krugl.web@gmail.com ---
It should have been defined similarly to APR_VERSION_STRING (using
APR_STRINGIFY and quotes around punctuation), but with commas instead of
periods.

-- 
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


[Bug 59057] APR_VERSION_STRING_CSV from apr_version.h is malformed and fails compilation with some compilers

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59057

vitaly.krugl.web@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from vitaly.krugl.web@gmail.com ---
The head version of the file containing malformed APR_VERSION_STRING_CSV
definition is
http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_version.h?view=markup


The 1.5.1 version of the file containing the malformed definition of
APR_VERSION_STRING_CSV is
http://svn.apache.org/viewvc/apr/apr/tags/1.5.1/include/apr_version.h?view=markup

-- 
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