Bug 723299 - [FEDORA:C++:READLINE] isxdigit should not be defined as a macro in readline
Summary: [FEDORA:C++:READLINE] isxdigit should not be defined as a macro in readline
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: readline
Version: rawhide
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Lukáš Nykrýn
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-19 16:34 UTC by Travis Gummels
Modified: 2011-08-31 07:56 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 722942
Environment:
Last Closed: 2011-08-31 07:56:51 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Travis Gummels 2011-07-19 16:34:13 UTC
+++ This bug was initially created as a clone of Bug #722942 +++

Description of problem:

The problem is that readline shouldn't be defining isxdigit as a macro ever. That is wrong in C++ because it is a template function. If you look at ctype.h you see the correct declaration which is excluded from C++ with: 

#if !defined __NO_CTYPE && !defined __cplusplus
<snip>
# define isxdigit(c)    __isctype((c), _ISxdigit)

This is a bug in readline.

Version-Release number of selected component (if applicable):
CURRENTRELEASE

How reproducible:
100%

Steps to Reproduce:
$ cat test.C 
#include <string> 
#include <readline/readline.h> 
#include <iostream> 

using namespace std; 

int main() { 
cout<<"Hi There "<<isxdigit(19)<<endl; return 0; 
} 


$ g++ test.C


Actual results: (lin numbers/versions different between RHEL 6 and Fedora but result should be same)

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:47,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,

                 from test.C:3:

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h:90:35: error: macro "isxdigit" passed 2 arguments, but takes just 1

In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_ios.h:44,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ios:50,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/ostream:44,

                 from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iostream:44,

                 from test.C:3:

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h:4609:45: error: macro "isxdigit" passed 2 arguments, but takes just 1

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h:90: error: 'std::isxdigit' declared as an 'inline' variable

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/localefwd.h:90: error: template declaration of 'bool std::isxdigit'

/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/locale_facets.h:4609: error: invalid function declaration

Expected results:

No garbage.

Additional info:

A simple fix in readline would be to add 

!defined __cplusplus to the declaration in chardefs.h

    75  #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT)
    76  #  define isxdigit(c)   (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
    77  #endif

so that line 75 ends up being:

    75  #if !defined (isxdigit) && !defined (HAVE_ISXDIGIT) && !defined (__cplusplus) 
    76  #  define isxdigit(c)   (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))
    77  #endif

Comment 1 Fedora Admin XMLRPC Client 2011-08-08 08:15:12 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 2 Lukáš Nykrýn 2011-08-31 07:56:51 UTC
fixed commited to git -> http://lists.fedoraproject.org/pipermail/scm-commits/2011-August/654445.html -> closed


Note You need to log in before you can comment on or make changes to this bug.