Hello!

During compilation of Vim 7.0 under AIX (5.1 or 5.2) I get the next error:
"message.c", line 4180.1: 1506-191 (E) The character # is not a valid C source character.
"message.c", line 4180.2: 1506-046 (S) Syntax error.
"message.c", line 4182.1: 1506-191 (E) The character # is not a valid C source character. "message.c", line 4185.1: 1506-191 (E) The character # is not a valid C source character.
"message.c", line 4185.2: 1506-275 (S) Unexpected text endif encountered.


Referred lines contain preprocessor directives:
                       char *q = memchr(str_arg, '\0',
##if SIZEOF_INT <= 2
                               precision
#else
                               precision <= (size_t)0x7fffffffL ? precision
                                                      : (size_t)0x7fffffffL
#endif


These directives are not compilable because function memchr() used in this code fragment on AIX is redefined as macro (see the fragment of the file /usr/include/string.h below):

/*
*   The following macro definitions cause the XLC compiler to inline
*   these functions whenever possible.
*/
#ifndef __cplusplus
#ifdef __STR__
#   define strcpy(__s1,__s2) __strcpy(__s1,__s2)
#   define strcmp(__s1,__s2) __strcmp(__s1,__s2)
      string.h = (/usr/include)
#   ifndef __STR31__
#       define strlen(__s1) __strlen(__s1)
#       define strchr(__s1,__c) __strchr(__s1,__c)
#       define strrchr(__s1,__c) __strrchr(__s1,__c)
#       define strcat(__s1,__s2) __strcat(__s1,__s2)
#       define memchr(__s1,__c,__n) __memchr(__s1,__c,__n)
#       define memcpy(__s1,__s2,__n) __memcpy(__s1,__s2,__n)
#       define memmove(__s1,__s2,__n) __memmove(__s1,__s2,__n)
#       define memcmp(__s1,__s2,__n) __memcmp(__s1,__s2,__n)
#       define memset(__s1,__c,__n) __memset(__s1,__c,__n)

I don't know exactly is it correct that the compiler does use this section for this moment.
I successfully applied the next workaround:

#if SIZEOF_INT <= 2
                       char *q = memchr(str_arg, '\0',
                               precision
                                                      );
#else
                       char *q = memchr(str_arg, '\0',
                               precision <= (size_t)0x7fffffffL ? precision
                                                      : (size_t)0x7fffffffL
                                                      );
#endif

Use it if you have no objections.

Thanks.
Oleg

Reply via email to