• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修訂e9f40d7d68ecc03c8c32ec0acd07c35359fdb4a3 (tree)
時間2015-11-09 13:48:35
作者Alan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

Modify obstack.[hc] to avoid having to include other gnulib files

Using the standard gnulib obstack source requires importing quite a
lot of other files from gnulib, and requires build changes.

include/
PR gdb/17133
* obstack.h (attribute_pure): Expand _GL_ATTRIBUTE_PURE.
libiberty/
PR gdb/17133
* obstack.c (alignof): Expand alignof_type from alignof.h.
(obstack_exit_failure): Don't use exitfail.h.
(_): Include libintl.h when HAVE_LIBINTL_H and nls enabled.
Provide default. Don't include gettext.h.
(_Noreturn): Define.
* obstacks.texi: Adjust node references to external libc info files.

Change Summary

差異

--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,6 +1,11 @@
11 2015-11-09 Alan Modra <amodra@gmail.com>
22
33 PR gdb/17133
4+ * obstack.h (__attribute_pure__): Expand _GL_ATTRIBUTE_PURE.
5+
6+2015-11-09 Alan Modra <amodra@gmail.com>
7+
8+ PR gdb/17133
49 * obstack.h: Import current gnulib file.
510
611 2015-10-22 H.J. Lu <hongjiu.lu@intel.com>
--- a/include/obstack.h
+++ b/include/obstack.h
@@ -142,7 +142,11 @@
142142 P, A)
143143
144144 #ifndef __attribute_pure__
145-# define __attribute_pure__ _GL_ATTRIBUTE_PURE
145+# if defined __GNUC_MINOR__ && __GNUC__ * 1000 + __GNUC_MINOR__ >= 2096
146+# define __attribute_pure__ __attribute__ ((__pure__))
147+# else
148+# define __attribute_pure__
149+# endif
146150 #endif
147151
148152 #ifdef __cplusplus
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,6 +1,16 @@
11 2015-11-09 Alan Modra <amodra@gmail.com>
22
33 PR gdb/17133
4+ * obstack.c (__alignof__): Expand alignof_type from alignof.h.
5+ (obstack_exit_failure): Don't use exitfail.h.
6+ (_): Include libintl.h when HAVE_LIBINTL_H and nls enabled.
7+ Provide default. Don't include gettext.h.
8+ (_Noreturn): Define.
9+ * obstacks.texi: Adjust node references to external libc info files.
10+
11+2015-11-09 Alan Modra <amodra@gmail.com>
12+
13+ PR gdb/17133
414 * obstack.c: Import current gnulib file.
515 * obstacks.texi: Updated doc, from glibc's manual/memory.texi.
616
--- a/libiberty/obstack.c
+++ b/libiberty/obstack.c
@@ -51,9 +51,14 @@
5151 /* If GCC, or if an oddball (testing?) host that #defines __alignof__,
5252 use the already-supplied __alignof__. Otherwise, this must be Gnulib
5353 (as glibc assumes GCC); defer to Gnulib's alignof_type. */
54-# if !defined __GNUC__ && !defined __alignof__
55-# include <alignof.h>
56-# define __alignof__(type) alignof_type (type)
54+# if !defined __GNUC__ && !defined __IBM__ALIGNOF__ && !defined __alignof__
55+# if defined __cplusplus
56+template <class type> struct alignof_helper { char __slot1; type __slot2; };
57+# define __alignof__(type) offsetof (alignof_helper<type>, __slot2)
58+# else
59+# define __alignof__(type) \
60+ offsetof (struct { char __slot1; type __slot2; }, __slot2)
61+# endif
5762 # endif
5863 # include <stdlib.h>
5964 # include <stdint.h>
@@ -309,17 +314,34 @@ _obstack_memory_used (struct obstack *h)
309314 # ifdef _LIBC
310315 int obstack_exit_failure = EXIT_FAILURE;
311316 # else
312-# include "exitfail.h"
313-# define obstack_exit_failure exit_failure
317+# ifndef EXIT_FAILURE
318+# define EXIT_FAILURE 1
319+# endif
320+# define obstack_exit_failure EXIT_FAILURE
314321 # endif
315322
316-# ifdef _LIBC
323+# if defined _LIBC || (HAVE_LIBINTL_H && ENABLE_NLS)
317324 # include <libintl.h>
325+# ifndef _
326+# define _(msgid) gettext (msgid)
327+# endif
318328 # else
319-# include "gettext.h"
329+# ifndef _
330+# define _(msgid) (msgid)
331+# endif
320332 # endif
321-# ifndef _
322-# define _(msgid) gettext (msgid)
333+
334+# if !(defined _Noreturn \
335+ || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112))
336+# if ((defined __GNUC__ \
337+ && (__GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))) \
338+ || (defined __SUNPRO_C && __SUNPRO_C >= 0x5110))
339+# define _Noreturn __attribute__ ((__noreturn__))
340+# elif defined _MSC_VER && _MSC_VER >= 1200
341+# define _Noreturn __declspec (noreturn)
342+# else
343+# define _Noreturn
344+# endif
323345 # endif
324346
325347 # ifdef _LIBC
--- a/libiberty/obstacks.texi
+++ b/libiberty/obstacks.texi
@@ -93,7 +93,7 @@ them are freed. These macros should appear before any use of obstacks
9393 in the source file.
9494
9595 Usually these are defined to use @code{malloc} via the intermediary
96-@code{xmalloc} (@pxref{Unconstrained Allocation}). This is done with
96+@code{xmalloc} (@pxref{Unconstrained Allocation, , , libc, The GNU C Library Reference Manual}). This is done with
9797 the following pair of macro definitions:
9898
9999 @smallexample
@@ -172,8 +172,8 @@ The value of this variable is a pointer to a function that
172172 @code{obstack} uses when @code{obstack_chunk_alloc} fails to allocate
173173 memory. The default action is to print a message and abort.
174174 You should supply a function that either calls @code{exit}
175-(@pxref{Program Termination}) or @code{longjmp} (@pxref{Non-Local
176-Exits}) and doesn't return.
175+(@pxref{Program Termination, , , libc, The GNU C Library Reference Manual}) or @code{longjmp} (@pxref{Non-Local
176+Exits, , , libc, The GNU C Library Reference Manual}) and doesn't return.
177177
178178 @smallexample
179179 void my_obstack_alloc_failed (void)
@@ -253,7 +253,7 @@ obstack_savestring (char *addr, size_t size)
253253
254254 @noindent
255255 Contrast this with the previous example of @code{savestring} using
256-@code{malloc} (@pxref{Basic Allocation}).
256+@code{malloc} (@pxref{Basic Allocation, , , libc, The GNU C Library Reference Manual}).
257257
258258 @node Freeing Obstack Objects
259259 @subsubsection Freeing Objects in an Obstack