You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1997/11/07 14:06:39 UTC

[PATCH] Take2: Show compile time switches for server

On Fri, Nov 07, 1997 at 02:48:07AM -0800, Dean Gaudet wrote:
> +1 on -V, but it looks like you put NO_WRITEV inside the USE_MMAP_FILES
> section, which is wrong ... NO_WRITEV isn't related to USE_MMAP_FILES. 


Ok, moved to behind the "#ifdef USE_MMAP_FILES" block.

BTW: I was thinking of reducing the code bloat a bit by using string
concatenation to collect all the strings into one printf() by writing...

    printf("Server compiled with....\n"
#ifdef BIG_SECURITY_HOLE
	   " -D BIG_SECURITY_HOLE\n"
#endif
#ifdef HTTPD_ROOT
	   " -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n"
#endif
....
	   "\n");

But then I'd need a (portable) ANSI-Stringizing Macro which converts
the _value_ of the num-valued macros into a string, like...

#define NUMSTR(n)   some_#_magic_i_couldnt_find_out
#ifdef MMAP_SEGMENT_SIZE
       " -D MMAP_SEGMENT_SIZE=" NUMSTR(MMAP_SEGMENT_SIZE) "\n"
#endif

Somehow I couldn't get it to work. The X3J11 standard doesn't give an
example either. Thus still Take 2: the printf() version (corrected re
NO_WRITEV).

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Take2: Show compile time switches for server

Posted by Dean Gaudet <dg...@arctic.org>.
Yeah I guess you'll have to be defensive ... ah well.

Dean

On Sun, 9 Nov 1997, Martin Kraemer wrote:

> On Fri, Nov 07, 1997 at 04:11:57PM -0800, Dean Gaudet wrote:
> > #define X 1
> > 
> > #define S(x) S1(x)
> > #define S1(x) #x
> > 
> > char *foo = S(X);
> 
> Oh, now I see why I had a problem... I tried it in a very similar
> approach. But look at my compiler's output (the first is "almost ANSI",
> the second "ANSI"):
> 
>     > cc -E deans-mac.c | tail -2
>     char *foo = "X";
>     #line 7
> 
>    > cc -kansi -E deans-mac.c | tail -2
>     char *foo = "1";
>     #line 7
> 
> Guess some compilers are on.y "conditionally compliant". Do you think
> it's woth taking the risk and changing the function to pure ANSI? I have
> the feeling that a more defensive approach would be better. :-(
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
> 


Re: [PATCH] Take2: Show compile time switches for server

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Fri, Nov 07, 1997 at 04:11:57PM -0800, Dean Gaudet wrote:
> #define X 1
> 
> #define S(x) S1(x)
> #define S1(x) #x
> 
> char *foo = S(X);

Oh, now I see why I had a problem... I tried it in a very similar
approach. But look at my compiler's output (the first is "almost ANSI",
the second "ANSI"):

    > cc -E deans-mac.c | tail -2
    char *foo = "X";
    #line 7

   > cc -kansi -E deans-mac.c | tail -2
    char *foo = "1";
    #line 7

Guess some compilers are on.y "conditionally compliant". Do you think
it's woth taking the risk and changing the function to pure ANSI? I have
the feeling that a more defensive approach would be better. :-(

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Take2: Show compile time switches for server

Posted by Dean Gaudet <dg...@arctic.org>.
#define X 1

#define S(x) S1(x)
#define S1(x) #x

char *foo = S(X);

I thought that was an example in the standard ... interesting.  It's the
way to do it though... every level of indirection adds another layer of
expansion. 

Dean

On Fri, 7 Nov 1997, Martin Kraemer wrote:

> On Fri, Nov 07, 1997 at 02:48:07AM -0800, Dean Gaudet wrote:
> > +1 on -V, but it looks like you put NO_WRITEV inside the USE_MMAP_FILES
> > section, which is wrong ... NO_WRITEV isn't related to USE_MMAP_FILES. 
> 
> 
> Ok, moved to behind the "#ifdef USE_MMAP_FILES" block.
> 
> BTW: I was thinking of reducing the code bloat a bit by using string
> concatenation to collect all the strings into one printf() by writing...
> 
>     printf("Server compiled with....\n"
> #ifdef BIG_SECURITY_HOLE
> 	   " -D BIG_SECURITY_HOLE\n"
> #endif
> #ifdef HTTPD_ROOT
> 	   " -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n"
> #endif
> ....
> 	   "\n");
> 
> But then I'd need a (portable) ANSI-Stringizing Macro which converts
> the _value_ of the num-valued macros into a string, like...
> 
> #define NUMSTR(n)   some_#_magic_i_couldnt_find_out
> #ifdef MMAP_SEGMENT_SIZE
>        " -D MMAP_SEGMENT_SIZE=" NUMSTR(MMAP_SEGMENT_SIZE) "\n"
> #endif
> 
> Somehow I couldn't get it to work. The X3J11 standard doesn't give an
> example either. Thus still Take 2: the printf() version (corrected re
> NO_WRITEV).
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
>