* [patch] Use MAXPATHLEN, fix sunos build problem
@ 2002-01-19 16:43 Andrew Cagney
2002-01-19 17:39 ` Jason R Thorpe
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-01-19 16:43 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 81 bytes --]
FYI,
I've checked in the attached to fix a build problem on SunOS 4.x.
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1007 bytes --]
2002-01-19 Andrew Cagney <ac131313@redhat.com>
* utils.c: Include <sys/param.h> for MAXPATHLEN.
(gdb_realpath): Use MAXPATHLEN when PATH_MAX is not defined.
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.55
diff -p -r1.55 utils.c
*** utils.c 2002/01/17 23:33:38 1.55
--- utils.c 2002/01/20 00:41:53
***************
*** 54,59 ****
--- 54,61 ----
#include "inferior.h" /* for signed_pointer_to_address */
+ #include <sys/param.h> /* For MAXPATHLEN */
+
#include <readline/readline.h>
#ifdef USE_MMALLOC
*************** char *
*** 2538,2544 ****
--- 2540,2552 ----
gdb_realpath (const char *filename)
{
#ifdef HAVE_REALPATH
+ #if defined (PATH_MAX)
char buf[PATH_MAX];
+ #elif defined (MAXPATHLEN)
+ char buf[MAXPATHLEN];
+ #else
+ #error "Neither PATH_MAX nor MAXPATHLEN defined"
+ #endif
char *rp = realpath (filename, buf);
return xstrdup (rp ? rp : filename);
#else
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Use MAXPATHLEN, fix sunos build problem
2002-01-19 16:43 [patch] Use MAXPATHLEN, fix sunos build problem Andrew Cagney
@ 2002-01-19 17:39 ` Jason R Thorpe
2002-01-19 18:56 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Jason R Thorpe @ 2002-01-19 17:39 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Sat, Jan 19, 2002 at 07:43:35PM -0500, Andrew Cagney wrote:
> 2002-01-19 Andrew Cagney <ac131313@redhat.com>
>
> * utils.c: Include <sys/param.h> for MAXPATHLEN.
> (gdb_realpath): Use MAXPATHLEN when PATH_MAX is not defined.
Seems like you really want PATH_MAX to be an autoconf test, and if
not, then test for MAXPATHLEN in <sys/param.h> and define PATH_MAX
in terms of MAXPATHLEN.
Basically, <machine/param.h> is by no means a standardized header, and
pulling it in causes all sorts of namespace pollution, so you wanna
use it only if you have to.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Use MAXPATHLEN, fix sunos build problem
2002-01-19 17:39 ` Jason R Thorpe
@ 2002-01-19 18:56 ` Andrew Cagney
2002-01-19 19:29 ` Jason R Thorpe
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-01-19 18:56 UTC (permalink / raw)
To: thorpej; +Cc: gdb-patches
> On Sat, Jan 19, 2002 at 07:43:35PM -0500, Andrew Cagney wrote:
>
> > 2002-01-19 Andrew Cagney <ac131313@redhat.com>
>> > * utils.c: Include <sys/param.h> for MAXPATHLEN.
> > (gdb_realpath): Use MAXPATHLEN when PATH_MAX is not defined.
>
> Seems like you really want PATH_MAX to be an autoconf test, and if
> not, then test for MAXPATHLEN in <sys/param.h> and define PATH_MAX
> in terms of MAXPATHLEN.
>
> Basically, <machine/param.h> is by no means a standardized header, and
> pulling it in causes all sorts of namespace pollution, so you wanna
> use it only if you have to.
Did you mean machine/param.h or sys/param.h? sys/param.h is currently
pulled in all over the place un-guarded (which is probably a bad thing).
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Use MAXPATHLEN, fix sunos build problem
2002-01-19 18:56 ` Andrew Cagney
@ 2002-01-19 19:29 ` Jason R Thorpe
2002-02-10 8:39 ` Andrew Cagney
0 siblings, 1 reply; 5+ messages in thread
From: Jason R Thorpe @ 2002-01-19 19:29 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
On Sat, Jan 19, 2002 at 09:56:43PM -0500, Andrew Cagney wrote:
> Did you mean machine/param.h or sys/param.h? sys/param.h is currently
> pulled in all over the place un-guarded (which is probably a bad thing).
Err, sorry, yes, I meant <sys/param.h>.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch] Use MAXPATHLEN, fix sunos build problem
2002-01-19 19:29 ` Jason R Thorpe
@ 2002-02-10 8:39 ` Andrew Cagney
0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2002-02-10 8:39 UTC (permalink / raw)
To: thorpej; +Cc: gdb-patches
> On Sat, Jan 19, 2002 at 07:43:35PM -0500, Andrew Cagney wrote:
>
> > 2002-01-19 Andrew Cagney <ac131313@redhat.com>
>> > * utils.c: Include <sys/param.h> for MAXPATHLEN.
> > (gdb_realpath): Use MAXPATHLEN when PATH_MAX is not defined.
>
> Seems like you really want PATH_MAX to be an autoconf test, and if
> not, then test for MAXPATHLEN in <sys/param.h> and define PATH_MAX
> in terms of MAXPATHLEN.
>
> Basically, <machine/param.h> is by no means a standardized header, and
> pulling it in causes all sorts of namespace pollution, so you wanna
> use it only if you have to.
This really begs a question. Should we put a bomb under utils.c
breaking it up into smaller chunks (gdb/utils/*.c) so that people can be
more confident about this.
At present utils.c contains so much that someone trying to change it is
never really sure what the consequences of an include file tweek are.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-02-10 16:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-19 16:43 [patch] Use MAXPATHLEN, fix sunos build problem Andrew Cagney
2002-01-19 17:39 ` Jason R Thorpe
2002-01-19 18:56 ` Andrew Cagney
2002-01-19 19:29 ` Jason R Thorpe
2002-02-10 8:39 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox