[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Patches] Fix glibc_localedef after recent merge
- To: <patches@xxxxxxxxxx>
- Subject: [Patches] Fix glibc_localedef after recent merge
- From: "Joseph S. Myers" <joseph@xxxxxxxxxxxxxxxx>
- Date: Thu, 7 Mar 2013 01:44:50 +0000
I've applied this patch to fix problems building glibc_localedef after a
recent merge from FSF. The build couldn't find programs/xmalloc.h
(include/programs/xmalloc.h in glibc) - since we don't want to add the
whole glibc include/ set of internal headers to the host header search
path when building glibc_localedef, the simplest approach to finding this
header seemed to be to copy it into glibc_localedef. There were also some
consequent changes to include/sys/cdefs.h to ensure some macros used by
the copied header are always defined as required.
Index: include/sys/cdefs.h
===================================================================
--- include/sys/cdefs.h (revision 22582)
+++ include/sys/cdefs.h (working copy)
@@ -47,9 +47,20 @@
# endif
#endif
-#if defined(__GNUC__) \
+#ifndef __attribute_malloc__
+# if defined(__GNUC__) \
+ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
+# define __attribute_malloc__ __attribute__ ((__malloc__))
+# else
+# define __attribute_malloc__ /* Ignore */
+# endif
+#endif
+
+#ifndef __attribute_alloc_size__
+# if defined(__GNUC__) \
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
-# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
-#else
-# define __attribute_alloc_size(...)
+# define __attribute_alloc_size__(...) __attribute__ ((alloc_size (__VA_ARGS__)))
+# else
+# define __attribute_alloc_size__(...)
+# endif
#endif
Index: include/programs/xmalloc.h
===================================================================
--- include/programs/xmalloc.h (revision 0)
+++ include/programs/xmalloc.h (revision 0)
@@ -0,0 +1,33 @@
+/* Memory related definitions for program modules.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _XMALLOC_H
+#define _XMALLOC_H 1
+
+#include <sys/cdefs.h>
+#include <stddef.h>
+
+/* Prototypes for a few program-wide used functions. */
+extern void *xmalloc (size_t n)
+ __attribute_malloc__ __attribute_alloc_size__ ((1));
+extern void *xcalloc (size_t n, size_t s)
+ __attribute_malloc__ __attribute_alloc_size__ ((1, 2));
+extern void *xrealloc (void *o, size_t n)
+ __attribute_malloc__ __attribute_alloc_size__ ((2));
+extern char *xstrdup (const char *) __attribute_malloc__;
+
+#endif /* xmalloc.h */
Index: ChangeLog.eglibc
===================================================================
--- ChangeLog.eglibc (revision 22582)
+++ ChangeLog.eglibc (working copy)
@@ -1,3 +1,11 @@
+2013-03-06 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * include/sys/cdefs.h (__attribute_malloc__): Define if not
+ already defined.
+ (__attribute_alloc_size): Change to __attribute_alloc_size__.
+ Define if not already defined.
+ * include/programs/xmalloc.h: Copy from glibc.
+
2013-01-23 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* configure.ac: Use AC_USE_SYSTEM_EXTENSIONS.
--
Joseph S. Myers
joseph@xxxxxxxxxxxxxxxx
_______________________________________________
Patches mailing list
Patches@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/patches