This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Make regex code more portable


The latest version of GNU sed fail to build on Irix (and several
other) because of some code using the GCC feature __attribute__.  I
use Irix as the example because the error messages from the compilers
are very good. :)

The error is in a file inherited from GNU libc, and the GNU sed
maintainer therefore asked me to post the patch here as well.  This
patch is relative to the GNU libc CVS, instead of relative to the GNU
sed source.

The compile fail with this message:

  cc-1070 cc: ERROR File = regcomp.c, Line = 296
    The indicated type is incomplete.

    __attribute ((always_inline))
                  ^

  cc-1065 cc: ERROR File = regcomp.c, Line = 297
    A semicolon is expected at this point.

    re_set_fastmap (char *fastmap, int icase, int ch)
    ^

The problem is in the regex_internal.h, keeping the attribute
statement for non-GCC compilers.  The following patch fixes the
problem.  It make sure the attributes are removed when not using GCC.

2003-12-16  Petter Reinholdtsen

	* posix/regex_internal.h: Make sure the regex code compile
	with non-GCC compilers by hiding attributes.

Index: posix/regex_internal.h
===================================================================
RCS file: /cvs/glibc/libc/posix/regex_internal.h,v
retrieving revision 1.35
diff -u -3 -p -u -r1.35 regex_internal.h
--- posix/regex_internal.h	29 Nov 2003 03:39:00 -0000	1.35
+++ posix/regex_internal.h	16 Dec 2003 10:32:28 -0000
@@ -107,9 +107,9 @@
 #endif /* not _LIBC */
 
 #ifdef __GNUC__
-# define __attribute __attribute__
+# define __attribute(a) __attribute__(a)
 #else
-# define __attribute
+# define __attribute(a)
 #endif
 
 extern const char __re_error_msgid[] attribute_hidden;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]