|
From: Carlo W. <li...@us...> - 2002-02-17 16:37:46
|
CVSROOT : /cvsroot/libcw
Module : src
Commit time: 2002-01-17 16:37:43 UTC
Modified files:
libcwd/acconfig.h libcwd/acinclude.m4 libcwd/debug.cc
libcwd/elf32.cc libcwd/documentation/tutorial/faq.m4
libcwd/documentation/tutorial/hello_world.cc
libcwd/documentation/tutorial/log_file.cc
libcwd/documentation/tutorial/tut1.m4
libcwd/documentation/tutorial/tut2.m4 libcwd/include/sys.ho.in
libcwd/testsuite/libcwd.tst/sys.h
Log message:
More _GNU_SOURCE fixes...
Only bother about queuing messages for gcc 3.0 and higher.
---------------------- diff included ----------------------
Index: src/libcwd/acconfig.h
diff -u src/libcwd/acconfig.h:1.12 src/libcwd/acconfig.h:1.13
--- src/libcwd/acconfig.h:1.12 Thu Feb 14 21:19:31 2002
+++ src/libcwd/acconfig.h Sun Feb 17 08:37:32 2002
@@ -22,8 +22,10 @@
// Defined when both -lpthread and pthread.h could be found.
#undef LIBCWD_HAVE_PTHREAD
+#if __GNUC__ < 3
// This is needed when using threading, for example to get `pthread_kill_other_threads_np'.
#undef _GNU_SOURCE
+#endif
// Defined when --enable-libcwd-threading is used.
#undef LIBCWD_THREAD_SAFE
Index: src/libcwd/acinclude.m4
diff -u src/libcwd/acinclude.m4:1.49 src/libcwd/acinclude.m4:1.50
--- src/libcwd/acinclude.m4:1.49 Thu Feb 14 21:36:09 2002
+++ src/libcwd/acinclude.m4 Sun Feb 17 08:37:32 2002
@@ -886,7 +886,6 @@
dnl Other options
if test "$USE_MAINTAINER_MODE" = yes; then
EXTRAOPTS="-O"
-DEBUGOPTS="-ggdb3"
else
EXTRAOPTS="-O"
fi
Index: src/libcwd/debug.cc
diff -u src/libcwd/debug.cc:1.71 src/libcwd/debug.cc:1.72
--- src/libcwd/debug.cc:1.71 Sat Feb 16 17:42:06 2002
+++ src/libcwd/debug.cc Sun Feb 17 08:37:33 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.71 2002/02/17 01:42:06 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/debug.cc,v 1.72 2002/02/17 16:37:33 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -126,7 +126,7 @@
)
#endif // LIBCWD_THREAD_SAFE
{
-#if defined(DEBUGMALLOC) && defined(LIBCWD_THREAD_SAFE)
+#if (__GNUC__ >= 3 || __GNUC_MINOR__ >= 97) && defined(LIBCWD_THREAD_SAFE) && defined(DEBUGMALLOC)
typedef debug_message_st* msgbuf_t;
msgbuf_t msgbuf;
// Queue the message when the default (STL) allocator is locked and it could be that we
@@ -155,7 +155,7 @@
msgbuf = (msgbuf_t)malloc(curlen + extra_size);
free_msgbuf = true;
}
-#if defined(DEBUGMALLOC) && defined(LIBCWD_THREAD_SAFE)
+#if (__GNUC__ >= 3 || __GNUC_MINOR__ >= 97) && defined(LIBCWD_THREAD_SAFE) && defined(DEBUGMALLOC)
rdbuf()->sgetn(msgbuf->buf, curlen);
#else
rdbuf()->sgetn(msgbuf, curlen);
@@ -183,7 +183,7 @@
}
}
#endif // !LIBCWD_THREAD_SAFE
-#if defined(DEBUGMALLOC) && defined(LIBCWD_THREAD_SAFE)
+#if (__GNUC__ >= 3 || __GNUC_MINOR__ >= 97) && defined(LIBCWD_THREAD_SAFE) && defined(DEBUGMALLOC)
if (queue_msg) // Inside a call to malloc and possibly owning lock of std::__default_alloc_template<true, 0>?
{
// We don't write debug output to the final ostream when inside malloc and std::__default_alloc_template<true, 0> is locked.
Index: src/libcwd/documentation/tutorial/faq.m4
diff -u src/libcwd/documentation/tutorial/faq.m4:1.6 src/libcwd/documentation/tutorial/faq.m4:1.7
--- src/libcwd/documentation/tutorial/faq.m4:1.6 Sun Feb 17 07:30:15 2002
+++ src/libcwd/documentation/tutorial/faq.m4 Sun Feb 17 08:37:33 2002
@@ -27,7 +27,7 @@
libcwd. If you need to write 100% ANSI code and you are not sure
whether or not new code that you added is an extension or not, you
should try to compile it with CWDEBUG undefined <EM>and</EM> using -ansi as
-command line option to g++; without -ansi g++-3.0.3 and higher define
+command line option to g++; without -ansi g++-3.0 and higher defines
_GNU_SOURCE itself by default.</P>
<A name="sysd.h"></A>
Index: src/libcwd/documentation/tutorial/hello_world.cc
diff -u src/libcwd/documentation/tutorial/hello_world.cc:1.4 src/libcwd/documentation/tutorial/hello_world.cc:1.5
--- src/libcwd/documentation/tutorial/hello_world.cc:1.4 Sun Feb 17 07:30:15 2002
+++ src/libcwd/documentation/tutorial/hello_world.cc Sun Feb 17 08:37:33 2002
@@ -2,7 +2,7 @@
// This block should really be part of custom header files! Please ignore it
// and read documentation/html/preparation.html#preparation_step2 instead.
// "sys.h":
-#ifndef _GNU_SOURCE // g++ 3.0.3 and higher already define this.
+#ifndef _GNU_SOURCE // g++ 3.0 and higher already defines this.
#define _GNU_SOURCE
#endif
#include <libcw/sysd.h> // This must be the first header file
Index: src/libcwd/documentation/tutorial/log_file.cc
diff -u src/libcwd/documentation/tutorial/log_file.cc:1.4 src/libcwd/documentation/tutorial/log_file.cc:1.5
--- src/libcwd/documentation/tutorial/log_file.cc:1.4 Sun Feb 17 07:30:15 2002
+++ src/libcwd/documentation/tutorial/log_file.cc Sun Feb 17 08:37:33 2002
@@ -2,7 +2,7 @@
// This block should really be part of custom header files! Please ignore it
// and read documentation/html/preparation.html#preparation_step2 instead.
// "sys.h":
-#ifndef _GNU_SOURCE // g++ 3.0.3 and higher already define this.
+#ifndef _GNU_SOURCE // g++ 3.0 and higher already defines this.
#define _GNU_SOURCE
#endif
#include <libcw/sysd.h> // This must be the first header file
Index: src/libcwd/documentation/tutorial/tut1.m4
diff -u src/libcwd/documentation/tutorial/tut1.m4:1.7 src/libcwd/documentation/tutorial/tut1.m4:1.8
--- src/libcwd/documentation/tutorial/tut1.m4:1.7 Sun Feb 17 07:30:15 2002
+++ src/libcwd/documentation/tutorial/tut1.m4 Sun Feb 17 08:37:33 2002
@@ -14,7 +14,7 @@
<PRE>
// These four lines should actually be part of a custom "sys.h" file. See <A HREF="tut2.html">tutorial 2</A>.
-#ifndef _GNU_SOURCE // Already defined by g++ 3.0.3 and higher.
+#ifndef _GNU_SOURCE // Already defined by g++ 3.0 and higher.
#define _GNU_SOURCE // This must be defined before including <libcw/sysd.h>
#endif
#include <libcw/sysd.h> // This must be the first header file
@@ -45,7 +45,7 @@
threading support.
If you do not define this macro and libcwd needs it, then you will get
a compile error in <libcw/sysd.h> telling you so.
-GNU gcc 3.0.3 (and higher) already defines this macro by itself, so there is
+GNU gcc 3.0 (and higher) already defines this macro by itself, so there is
no need to include it if you intend to only compile your application with
this version.</P>
Index: src/libcwd/documentation/tutorial/tut2.m4
diff -u src/libcwd/documentation/tutorial/tut2.m4:1.5 src/libcwd/documentation/tutorial/tut2.m4:1.6
--- src/libcwd/documentation/tutorial/tut2.m4:1.5 Sun Feb 17 07:30:15 2002
+++ src/libcwd/documentation/tutorial/tut2.m4 Sun Feb 17 08:37:33 2002
@@ -18,7 +18,7 @@
#endif
#ifdef CWDEBUG // This is needed so that others can compile
// your application without having libcwd installed.
-#ifndef _GNU_SOURCE // Already defined by g++ 3.0.3 and higher.
+#ifndef _GNU_SOURCE // Already defined by g++ 3.0 and higher.
#define _GNU_SOURCE // Needed for libpthread extensions.
#endif
#include <libcw/sysd.h>
Index: src/libcwd/elf32.cc
diff -u src/libcwd/elf32.cc:1.37 src/libcwd/elf32.cc:1.38
--- src/libcwd/elf32.cc:1.37 Sat Feb 16 17:42:06 2002
+++ src/libcwd/elf32.cc Sun Feb 17 08:37:33 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.37 2002/02/17 01:42:06 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/elf32.cc,v 1.38 2002/02/17 16:37:33 libcw Exp $
//
// Copyright (C) 2001, by
//
@@ -1125,6 +1125,10 @@
void object_file_ct::load_dwarf(void)
{
+#if __GNUC__ == 2 && __GNUC_MINOR__ == 96
+ Dout(dc::warning, "gcc/g++ 2.96 has broken DWARF2 debug information. Source file / Line number lookups will fail frequently. "
+ "Use either g++ 2.95.x, 3.x or -gstabs.");
+#endif
uint32_t total_length;
if (DEBUGDWARF)
{
@@ -1663,7 +1667,14 @@
}
}
}
+#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
+#ifdef DEBUGDEBUG // Play safe.
+ // g++ bug work around.
+ LIBCWD_ASSERT( debug_line_ptr == debug_line_ptr_end || debug_line_ptr == debug_line_ptr_end + 1 );
+#endif
+#else
LIBCWD_ASSERT( debug_line_ptr == debug_line_ptr_end );
+#endif
// End state machine code.
// ===========================================================================================================================17"
Index: src/libcwd/include/sys.ho.in
diff -u src/libcwd/include/sys.ho.in:1.9 src/libcwd/include/sys.ho.in:1.10
--- src/libcwd/include/sys.ho.in:1.9 Sat Feb 16 17:42:07 2002
+++ src/libcwd/include/sys.ho.in Sun Feb 17 08:37:33 2002
@@ -1,7 +1,7 @@
// @configure_input@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/include/sys.ho.in,v 1.9 2002/02/17 01:42:07 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/include/sys.ho.in,v 1.10 2002/02/17 16:37:33 libcw Exp $
//
-// Copyright (C) 2000 - 2001, by
+// Copyright (C) 2000 - 2002, by
//
// Carlo Wood, Run on IRC <ca...@al...>
// RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
@@ -15,7 +15,6 @@
#ifndef SYS_H
#define SYS_H
-#undef _GNU_SOURCE // Could be defined by g++ itself and redefined in ../config.h
#include "../config.h"
//
Index: src/libcwd/testsuite/libcwd.tst/sys.h
diff -u src/libcwd/testsuite/libcwd.tst/sys.h:1.5 src/libcwd/testsuite/libcwd.tst/sys.h:1.6
--- src/libcwd/testsuite/libcwd.tst/sys.h:1.5 Sat Feb 16 17:42:07 2002
+++ src/libcwd/testsuite/libcwd.tst/sys.h Sun Feb 17 08:37:33 2002
@@ -1,4 +1,4 @@
-// $Header: /cvsroot/l/li/libcw/src/libcwd/testsuite/libcwd.tst/sys.h,v 1.5 2002/02/17 01:42:07 libcw Exp $
+// $Header: /cvsroot/l/li/libcw/src/libcwd/testsuite/libcwd.tst/sys.h,v 1.6 2002/02/17 16:37:33 libcw Exp $
//
// Copyright (C) 2000 - 2001, by
//
@@ -14,13 +14,13 @@
#ifndef TESTSUITE_SYS_H
#define TESTSUITE_SYS_H
+#include "../../config.h"
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <libcw/sysd.h>
-#undef _GNU_SOURCE
-#include "../../config.h"
#ifdef HAVE__G_CONFIG_H
#include <_G_config.h>
#ifndef _G_CLOG_CONFLICT
----------------------- End of diff -----------------------
|