You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Garrett Rooney <ro...@electricjellyfish.net> on 2003/01/21 15:51:47 UTC

warnings from sys/syslimits.h on FreeBSD 5.0

so i'm building subversion (and thus apr) on FreeBSD 5.0, and i'm 
getting a TON of warnings about including sys/syslimits.h, since 
apparently it's not supposed to be included from user code, just from 
within the kernel or limits.h or sys/param.h.  the check in 
sys/syslimits.h is as follows:

#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
#if __GNUC__
#warning "No user-serviceable parts inside."
#endif
#endif

looking in apr.h where we include sys/syslimits.h, we're also including 
limits.h, which on this system gets us the contents of sys/syslimits.h 
anyway, so my first instinct is to change it to only include 
sys/syslimits.h if we don't have limits.h, but i suppose that is likely 
to break on other systems or something...

any ideas?

-garrett


Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Craig Rodrigues <ro...@attbi.com>.
On Tue, Jan 21, 2003 at 04:01:05PM +0000, Thom May wrote:
> >    to:
> > 
> > /* header files for PATH_MAX, _POSIX_PATH_MAX */
> > #if APR_HAVE_LIMITS_H
> > #include <limits.h>
> > #endif
> > #if APR_HAVE_SYS_SYSLIMITS_H
> > #include <sys/syslimits.h>
> > #endif
> surely you mean: 
> 
> #include <limits.h>
> #elsif APR_HAVE_SYS_SYSLIMITS_H
> #include ...
> 
> otherwise we still have the same problem?

Nope, because in FreeBSD's <sys/syslimits.h> there is this:

#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
#if __GNUC__
#warning "No user-serviceable parts inside."
#endif
#endif


So, if you change the order of the includes, the warning goes away.


--
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@attbi.com

Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Thom May <th...@planetarytramp.net>.
* Garrett Rooney (rooneg@electricjellyfish.net) wrote :
> Thom May wrote:
> 
> > 
> >
> >surely you mean: 
> >
> >#include <limits.h>
> >#elsif APR_HAVE_SYS_SYSLIMITS_H
> >#include ...
> >
> >otherwise we still have the same problem?
> >-Thom
> > 
> >
> 
> changing it to
> 
> #if APR_HAVE_LIMITS_H
> #include <limits.h>
> #else
> #if APR_HAVE_SYS_SYSLIMITS_H
> #include <sys/syslimits.h>
> #endif
> #endif
> 
> solved the problem.  i suppose switching the order would work on 
> FreeBSD, but it seems like we're relying on an ugly little 
> implementation detail, so i'd rather either do this or make configure 
> not pick up sys/syslimits.h when limits.h is found.
> 
Indeed. I'm happy with this in the short term, but longer term we should be
aiming for Jeff's proposal.
I'll fix this up now unless there are any objections?
Cheers,
-Thom

Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Thom May <th...@planetarytramp.net>.
* Garrett Rooney (rooneg@electricjellyfish.net) wrote :
> Thom May wrote:
> 
> > 
> >
> >surely you mean: 
> >
> >#include <limits.h>
> >#elsif APR_HAVE_SYS_SYSLIMITS_H
> >#include ...
> >
> >otherwise we still have the same problem?
> >-Thom
> > 
> >
> 
> changing it to
> 
> #if APR_HAVE_LIMITS_H
> #include <limits.h>
> #else
> #if APR_HAVE_SYS_SYSLIMITS_H
> #include <sys/syslimits.h>
> #endif
> #endif
> 
Right, so basically the attached patch?
If no-one has any objections, I'd like to commit this in the morning, then
we can start looking at the configure system in the long term.
Cheers,
-Thom


Index: include/apr.h.in
===================================================================
RCS file: /home/cvs/apr/include/apr.h.in,v
retrieving revision 1.117
diff -u -u -r1.117 apr.h.in
--- include/apr.h.in	22 Oct 2002 12:37:40 -0000	1.117
+++ include/apr.h.in	21 Jan 2003 21:48:16 -0000
@@ -304,11 +304,12 @@
 #endif
 
 /* header files for PATH_MAX, _POSIX_PATH_MAX */
+#if APR_HAVE_LIMITS_H
+#include <limits.h>
+#else
 #if APR_HAVE_SYS_SYSLIMITS_H
 #include <sys/syslimits.h>
 #endif
-#if APR_HAVE_LIMITS_H
-#include <limits.h>
 #endif
 
 #if defined(PATH_MAX)

Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
Thom May wrote:

>  
>
>surely you mean: 
>
>#include <limits.h>
>#elsif APR_HAVE_SYS_SYSLIMITS_H
>#include ...
>
>otherwise we still have the same problem?
>-Thom
>  
>

changing it to

#if APR_HAVE_LIMITS_H
#include <limits.h>
#else
#if APR_HAVE_SYS_SYSLIMITS_H
#include <sys/syslimits.h>
#endif
#endif

solved the problem.  i suppose switching the order would work on 
FreeBSD, but it seems like we're relying on an ugly little 
implementation detail, so i'd rather either do this or make configure 
not pick up sys/syslimits.h when limits.h is found.

-garrett


Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Thom May <th...@planetarytramp.net>.
* Craig Rodrigues (rodrigc@attbi.com) wrote :
> On Tue, Jan 21, 2003 at 09:51:47AM -0500, Garrett Rooney wrote:
> > looking in apr.h where we include sys/syslimits.h, we're also including 
> > limits.h, which on this system gets us the contents of sys/syslimits.h 
> > anyway, so my first instinct is to change it to only include 
> > sys/syslimits.h if we don't have limits.h, but i suppose that is likely 
> > to break on other systems or something...
> 
> Idea 1:
>   - remove include of <sys/syslimits.h> unless someone can prove that
>     not including it will break something

I'm sure something somewhere will break ;-)

> 
> Idea 2:
>   - Change:
> /* header files for PATH_MAX, _POSIX_PATH_MAX */
> #if APR_HAVE_SYS_SYSLIMITS_H
> #include <sys/syslimits.h>
> #endif
> #if APR_HAVE_LIMITS_H
> #include <limits.h>
> #endif
> 
> 
>    to:
> 
> /* header files for PATH_MAX, _POSIX_PATH_MAX */
> #if APR_HAVE_LIMITS_H
> #include <limits.h>
> #endif
> #if APR_HAVE_SYS_SYSLIMITS_H
> #include <sys/syslimits.h>
> #endif
surely you mean: 

#include <limits.h>
#elsif APR_HAVE_SYS_SYSLIMITS_H
#include ...

otherwise we still have the same problem?
-Thom

Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Jeff Trawick <tr...@attglobal.net>.
Craig Rodrigues wrote:

> On Tue, Jan 21, 2003 at 09:51:47AM -0500, Garrett Rooney wrote:
>
> >looking in apr.h where we include sys/syslimits.h, we're also including
> >limits.h, which on this system gets us the contents of sys/syslimits.h
> >anyway, so my first instinct is to change it to only include
> >sys/syslimits.h if we don't have limits.h, but i suppose that is likely
> >to break on other systems or something...
>
>
> Idea 1:
>   - remove include of  unless someone can prove that
>     not including it will break something


uh, why would it be there to start with :)

Idea 3:
change the way that APR detects header files to account for such
warnings, so that on uplevel FreeBSD APR won't even think that the
header file exists...

this has happened before and will probably happen again, which is
why I think the detection mechanism needs to be made smarter


Re: warnings from sys/syslimits.h on FreeBSD 5.0

Posted by Craig Rodrigues <ro...@attbi.com>.
On Tue, Jan 21, 2003 at 09:51:47AM -0500, Garrett Rooney wrote:
> looking in apr.h where we include sys/syslimits.h, we're also including 
> limits.h, which on this system gets us the contents of sys/syslimits.h 
> anyway, so my first instinct is to change it to only include 
> sys/syslimits.h if we don't have limits.h, but i suppose that is likely 
> to break on other systems or something...

Idea 1:
  - remove include of <sys/syslimits.h> unless someone can prove that
    not including it will break something

Idea 2:
  - Change:
/* header files for PATH_MAX, _POSIX_PATH_MAX */
#if APR_HAVE_SYS_SYSLIMITS_H
#include <sys/syslimits.h>
#endif
#if APR_HAVE_LIMITS_H
#include <limits.h>
#endif


   to:

/* header files for PATH_MAX, _POSIX_PATH_MAX */
#if APR_HAVE_LIMITS_H
#include <limits.h>
#endif
#if APR_HAVE_SYS_SYSLIMITS_H
#include <sys/syslimits.h>
#endif

-- 
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@attbi.com