Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Define _GNU_SOURCE to get rid of implicit function declarations

Hi,

I've been working on porting eclipse to 64 bit platforms. I
discovered that CDT debug will not work on x86_64 or ia64 running
GNU/Linux because of some implicit function declarations, which lead to
Null Pointer Exceptions. With the -Wall flag added, the following
warnings are produced when you build the CDT native code (in
org.eclipse.cdt.core.linux):

exec_unix.c: In function `exec0':
exec_unix.c:51: warning: unused variable `ptr'
exec_unix.c:93: warning: unused variable `b'
exec_unix.c:51: warning: unused variable `ptr'
exec_unix.c:93: warning: unused variable `b'

openpty.c: In function `ptym_open':
openpty.c:62: warning: implicit declaration of function `getpt'
openpty.c:65: warning: implicit declaration of function `grantpt'
openpty.c:69: warning: implicit declaration of function `unlockpt'
openpty.c:73: warning: implicit declaration of function `ptsname'
openpty.c:73: warning: assignment makes pointer from integer without a
cast

To get rid of these warnings and to get CDT debug to work, I had to
define the macro _GNU_SOURCE for GNU extensions. A very simple patch is
attached. 

Peter Faltaous

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.linux/ChangeLog,v
retrieving revision 1.3
diff -c -p -u -r1.3 ChangeLog
--- ChangeLog	2 Feb 2003 03:29:29 -0000	1.3
+++ ChangeLog	26 Feb 2004 22:28:44 -0000
@@ -1,3 +1,9 @@
+2004-02-26 Peter Faltaous
+
+	* library/Makefile:
+	CFLAGS: Add -Wall to show all warnings and define
+	_GNU_SOURCE to get rid of implicit function declarations
+
 2003-02-01 Alain Magloire
 
 	* library/ptyio.c: Do not throw any exception.
Index: library/Makefile
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.linux/library/Makefile,v
retrieving revision 1.7
diff -c -p -u -r1.7 Makefile
--- library/Makefile	31 Jan 2003 20:00:25 -0000	1.7
+++ library/Makefile	26 Feb 2004 22:28:44 -0000
@@ -13,7 +13,7 @@ JDK_OS_INCLUDES= $(JAVA_HOME)/include/$(
 
 CC=gcc
 CPPFLAGS = -I. -I$(JDK_INCLUDES) -I$(JDK_OS_INCLUDES)
-CFLAGS +=-fpic -D_REENTRANT
+CFLAGS +=-fpic -D_REENTRANT -Wall -D_GNU_SOURCE
 
 INSTALL_DIR = ../os/$(OS)/$(ARCH)
 

Back to the top