This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Various] libc/2757: Multiple <bits/byteswap.h> erroneus include



Hi libc developers,

Shouldn't we add multiple include markers around the files in
<bits/*>?  Or what should be done?

Andreas

--- Begin Message ---
Topics:
   libc/2757: Multiple <bits/byteswap.h> erroneus include
   Re: libc/2757: Multiple <bits/byteswap.h> erroneus include

--- End Message ---
--- Begin Message ---
>Number:         2757
>Category:       libc
>Synopsis:       Multiple <bits/byteswap.h> erroneus include
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    libc-gnats
>State:          open
>Quarter:        
>Keywords:       
>Class:          sw-bug
>Submitter-Id:   gnatsweb
>Arrival-Date:   Sat Dec 29 06:18:58 -0500 2001
>Cases:          
>Originator:     Serassio Guido
>Release:        Glibc 2.2.4
>Organization:

>Environment:
Red Hat Linux 7.0 on Alpha Processor
Kernel 2.4.17
Glibc 2.2.4-20 from RawHide 
Compaq C Compiler for Linux Alpha 6.4.9.005-1
>Description:
Include file <netinet/in.h> at line 270 includes <bits/byteswap.h> without
defining _BYTESWAP_H as do <byteswap.h>.
So, including <byteswap.h> after <netinet/in.h> gives a redefinition
error when using Compaq C Compiler.
>How-To-Repeat:
Compiling Squid 2.5 DEVEL on the target environment.
>Fix:
Include <byteswap.h> in <netinet/in.h> instead of <bits/byteswap.h>
>Unformatted:
 


--- End Message ---
--- Begin Message ---
Hi Andreas,

Il 12.39 29/12/2001 Andreas Jaeger ha scritto:
>serassio@libero.it writes:
>
> >>Number:         2757
> >>Category:       libc
> >>Synopsis:       Multiple <bits/byteswap.h> erroneus include
> >>Confidential:   no
> >>Severity:       non-critical
> >>Priority:       high
> >>Responsible:    libc-gnats
> >>State:          open
> >>Quarter:
> >>Keywords:
> >>Class:          sw-bug
> >>Submitter-Id:   gnatsweb
> >>Arrival-Date:   Sat Dec 29 06:18:58 -0500 2001
> >>Cases:
> >>Originator:     Serassio Guido
> >>Release:        Glibc 2.2.4
> >>Organization:
> >
> >>Environment:
> > Red Hat Linux 7.0 on Alpha Processor
> > Kernel 2.4.17
> > Glibc 2.2.4-20 from RawHide
> > Compaq C Compiler for Linux Alpha 6.4.9.005-1
> >>Description:
> > Include file <netinet/in.h> at line 270 includes <bits/byteswap.h> without
> > defining _BYTESWAP_H as do <byteswap.h>.
>
>I don't see a problem in this.
>
>Can you provide a simple test case together with the output of the
>compiler so that I see what's going on?  Does the problem also occur
>with GCC?

First, thanks for the quick response !!!

With GCC all compiles fine.

The following is the output from Compaq C Compiler (ccc) compiling a small 
test code:

serassio@io serassio]$ ccc prova.c
cc: Error: /usr/include/bits/byteswap.h, line 32: This declaration contains 
a redefinition of "__bswap_16
".  The previous declaration is at line number 32 in file 
/usr/include/bits/byteswap.h. (redef)
__bswap_16 (unsigned short int __bsx)
^
cc: Error: /usr/include/bits/byteswap.h, line 47: This declaration contains 
a redefinition of "__bswap_32
".  The previous declaration is at line number 47 in file 
/usr/include/bits/byteswap.h. (redef)
__bswap_32 (unsigned int __bsx)
^
[serassio@io serassio]$ uname -a
Linux io.sg.private 2.4.17 #3 Thu Dec 27 22:13:42 CET 2001 alpha unknown
[serassio@io serassio]$ ccc -V
Compaq C V6.4-005 on Linux 2.4.17 alpha
Compiler Driver V6.4-005 (Linux) cc Driver
Installed as ccc-6.4.9.005-1
Red Hat Linux release 7.0 (Guinness)
Using /usr/lib/gcc-lib/alpha-redhat-linux/2.96 (4).
[serassio@io serassio]$ gcc --version
2.96


This is the source:

#include        <stdio.h>
#include        <netinet/in.h>
#include        <byteswap.h>

void main(void)
{

         printf("Hello World !!!\n");
}


Looking at include dependencies in source, i can find that 
<bits/byteswap.h> is included twice, one time implicitly from 
<netinet/in.h>, the second time explicitly including <byteswap.h>, but 
generating the error because _BYTESWAP_H is defined and checked only in 
<byteswap.h>.

After editing line 270 of <netinet/in.h> from

#include <bits/byteswap.h> */

to :

#include <byteswap.h>

all compiles fine with ccc too.

Regards

Guido

>Andreas
>--
>  Andreas Jaeger
>   SuSE Labs aj@suse.de
>    private aj@arthur.inka.de
>     http://www.suse.de/~aj


-
=======================================================
Serassio Guido
Via Albenga, 11/4                                       10134 - Torino - ITALY
E-mail: serassio@interfree.it
         serassio@libero.it
WWW: http://www.serassio.it


--- End Message ---

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]