[Buildroot] [buildroot 0001491]: QTopia4 and uclibc string.h macro "index()" conflict

bugs at busybox.net bugs at busybox.net
Thu Sep 6 15:54:22 UTC 2007

The following issue has been SUBMITTED. 
Reported By:                HappyCactus
Assigned To:                buildroot
Project:                    buildroot
Issue ID:                   1491
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
Date Submitted:             09-06-2007 08:54 PDT
Last Modified:              09-06-2007 08:54 PDT
Summary:                    QTopia4 and uclibc string.h macro "index()" conflict
QTopia4 4.3.1 and uclibc doesn't compile when
__UCLIBC_SUSV3_LEGACY_MACROS__ is defined in uclibc.
Infacts we see in $(STAGING_DIR)/usr/include/string.h:

/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
 * They are replaced as proposed by SuSv3. Don't sync this part
 * with glibc and keep it in sync with strings.h.  */

#  define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
#  define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
#  define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
#  define index(s,c) strchr((s), (c))
#  define rindex(s,c) strrchr((s), (c))
#  endif

Not very smart to define a macro for this very common names. Imagine what
happens if src/corelib/kernel/qabstractitemmodel.h contains his code:

class Q_CORE_EXPORT QAbstractItemModel : public QObject
// ...
    virtual QModelIndex index(int row, int column,
           const QModelIndex &parent = QModelIndex()) const = 0;
Of course, the preprocessor changes the index to strchr( ... and doesn't
A workaround is a patch for the QByteArray.h file that unsets the macro.
But it should be better to change the #define index(r,s) with a simple
call to the chrchr () function and let the compiler do his optimizations.


Issue History 
Date Modified   Username       Field                    Change               
09-06-07 08:54  HappyCactus    New Issue                                    
09-06-07 08:54  HappyCactus    Status                   new => assigned     
09-06-07 08:54  HappyCactus    Assigned To               => buildroot       

More information about the buildroot mailing list