Article View: gnu.gdb.bug
Article #477gdb 4.6/ISC 2.2.1/<signal.h> & S_IFDIR
From: Karl Berry
Date: Wed, 14 Oct 1992 10:33
Date: Wed, 14 Oct 1992 10:33
147 lines
4753 bytes
4753 bytes
I tried to compile GDB 4.6 on Interactive Unix 2.2.1, a system
V-based-but-supposedly-POSIX system, and had a few troubles, which I
will detail in separate messages.
I did `configure i386-sysv', and compiled with:
CC="gcc -O -posix -DHAVE_UNISTD_H -DUSG -DTIOCGETC_BROKEN -DTIOCGLTC_BROKEN"
In the gdb directory, <sys/types.h> must be included before <signal.h>
when compiling in the POSIX environment. POSIX allows systems to
require this, as I understand it.
The S_IFDIR bit used in source.c is not defined; POSIX requires
only the S_ISDIR predicate.
defs.h declares memcpy and memcmp in a way that might conflict with
the GCC 2 builtins, producing useless warnings. I don't see any point
to declaring the builtin functions. (I also don't see any point in GCC
complaining about mismatched declarations with builtins, but that's a
different subject.)
Here are the diffs.
Fri Oct 2 15:01:06 1992 Karl Berry (karl@cs.umb.edu)
* {inf{cmd,run},maint}.c: include <sys/types.h> before <signal.h>.
* source.c (S_ISDIR) [!S_ISDIR && S_IFDIR]: New macro.
(mod_path): Use S_ISDIR to test for directory-ness.
* defs.h (memcpy, memcmp) [__GNUC__ > =2]: Do not declare; they're
builtin.
*** ./ORIG/core.c Mon Jul 6 13:10:41 1992
--- ./core.c Fri Oct 2 15:14:00 1992
***************
*** 19,24 ****
--- 19,25 ----
#include "defs.h"
#include <errno.h>
+ #include <sys/types.h>
#include <signal.h>
#include <fcntl.h>
#include "frame.h" /* required by inferior.h */
*** ./ORIG/defs.h Tue Jul 14 03:34:21 1992
--- ./defs.h Fri Oct 2 15:00:51 1992
***************
*** 667,672 ****
--- 667,673 ----
size_t size,
int (*comp)(const void *, const void *)));
+ #if __GNUC__ < 2
#ifndef MEM_FNS_DECLARED /* Some non-ANSI use void *, not char *. */
extern PTR
memcpy PARAMS ((void *, const void *, size_t)); /* 4.11.2.1 */
***************
*** 674,679 ****
--- 675,681 ----
extern int
memcmp PARAMS ((const void *, const void *, size_t)); /* 4.11.4.1 */
+ #endif
extern char *
strchr PARAMS ((const char *, int)); /* 4.11.5.2 */
*** ./ORIG/infcmd.c Mon Jul 6 13:10:52 1992
--- ./infcmd.c Fri Oct 2 15:07:01 1992
***************
*** 18,23 ****
--- 18,24 ----
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
+ #include <sys/types.h>
#include <signal.h>
#include <sys/param.h>
#include <string.h>
*** ./ORIG/infrun.c Mon Jul 6 13:10:54 1992
--- ./infrun.c Fri Oct 2 15:08:16 1992
***************
*** 113,118 ****
--- 113,119 ----
#include "terminal.h" /* For #ifdef TIOCGPGRP and new_tty */
#include "target.h"
+ #include <sys/types.h>
#include <signal.h>
/* unistd.h is needed to #define X_OK */
*** ./ORIG/maint.c Tue Jul 14 03:34:28 1992
--- ./maint.c Fri Oct 2 15:12:00 1992
***************
*** 23,28 ****
--- 23,29 ----
#if MAINTENANCE_CMDS /* Entire file goes away if not including maint cmds */
+ #include <sys/types.h>
#include <signal.h>
#include "command.h"
#include "gdbcmd.h"
*** ./ORIG/signals.h Tue Jun 4 03:29:53 1991
--- ./signals.h Fri Oct 2 14:57:07 1992
***************
*** 23,28 ****
--- 23,29 ----
(or, on some systems, when job control is there but doesn't work
the way GDB expects it to work). */
+ #include <sys/types.h>
#include <signal.h>
#ifdef NO_JOB_CONTROL
*** ./ORIG/source.c Mon Jul 6 13:11:05 1992
--- ./source.c Fri Oct 2 15:03:00 1992
***************
*** 38,43 ****
--- 38,47 ----
#include "symfile.h"
#include "objfiles.h"
+ #if !defined(S_ISDIR) && defined(S_IFDIR)
+ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+ #endif
+
/* Prototypes for local functions. */
static int
***************
*** 351,357 ****
if (name[0] != '$') {
if (stat (name, &st) < 0)
perror_with_name (name);
! if ((st.st_mode & S_IFMT) != S_IFDIR)
error ("%s is not a directory.", name);
}
--- 355,361 ----
if (name[0] != '$') {
if (stat (name, &st) < 0)
perror_with_name (name);
! if (!S_ISDIR (st.st_mode))
error ("%s is not a directory.", name);
}
Technical Details
Message-ID:
<199210141833.AA11844@claude.cs.umb.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!claude.cs.umb.edu!karlShow Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!claude.cs.umb.edu!karl From: karl@claude.cs.umb.edu (Karl Berry) Subject: gdb 4.6/ISC 2.2.1/<signal.h> & S_IFDIR Message-ID: <199210141833.AA11844@claude.cs.umb.edu> Sender: gnulists@ai.mit.edu Reply-To: karl@cs.umb.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 14 Oct 1992 10:33:44 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 148