[ python-Bugs-1105699 ] Warnings in Python.h with gcc 4.0.0

SourceForge.net noreply at sourceforge.net
Mon Mar 14 23:52:47 CET 2005


Bugs item #1105699, was opened at 2005-01-19 19:52
Message generated for change (Comment added) made by etrepum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1105699&group_id=5470

Category: Build
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Bob Ippolito (etrepum)
Assigned to: Nobody/Anonymous (nobody)
Summary: Warnings in Python.h with gcc 4.0.0

Initial Comment:
(this happens for every file that includes Python.h)

In file included from ../Include/Python.h:55,
                 from ../Objects/intobject.c:4:
../Include/pyport.h:396: warning: 'struct winsize' declared inside 
parameter list
../Include/pyport.h:397: warning: 'struct winsize' declared inside 
parameter list

The source lines look like this:
extern int openpty(int *, int *, char *, struct termios *, struct 
winsize *);
extern int forkpty(int *, char *, struct termios *, struct winsize *);

----------------------------------------------------------------------

>Comment By: Bob Ippolito (etrepum)
Date: 2005-03-14 17:52

Message:
Logged In: YES 
user_id=139309

Turns out that this is a GCC4 bug (not sure which, though).  The OS 
headers are fine.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2005-03-04 15:15

Message:
Logged In: YES 
user_id=21627

What operating system is this on? struct winsize should have
been included through <termios.h>. Then, the mentioning of
it in the propotypes is not a declaration, just a reference.

So if you get this warning, it probably indicates a problem
with your system headers.

----------------------------------------------------------------------

Comment By: Richard Kettlewell (rjk1002)
Date: 2005-01-31 10:43

Message:
Logged In: YES 
user_id=217390

C does guarantee that all struct pointers share the same
*representation* (section 6.2.5 of C99).  That's not what
the compiler is complaining about here.
Rather, a struct declared inside a parameter list is
restricted in scope to that parameter list, and so is not
the same structure as one declared outside it, even if the
tag is the same.
The solution is to forward-declare the struct (as an
incomplete type, i.e. just "struct winsize;") before any of
the declarations that use it.  Then the struct tag will mean
the same thing in every scope.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2005-01-20 18:13

Message:
Logged In: YES 
user_id=31435

The warning almost certainly means that there's no 
declaration of struct winsize in scope when these externs are 
declared.  That's bad, because C doesn't guarantee that all 
pointers are the same size (although they are on all Python 
platforms I'm aware of).

Some quality time with Google suggested that other projects 
wormed around this by #include'ing <termio.h> instead of 
<termios.h>, because the former but not the latter #include's 
<sys/ioctl.h> where the winsize struct was defined.  Beats 
me -- ain't a Windows problem <wink>.

----------------------------------------------------------------------

Comment By: Bob Ippolito (etrepum)
Date: 2005-01-20 17:49

Message:
Logged In: YES 
user_id=139309

Beats me, it's probably just "bad style".

It's a problem because it shows up a lot in the output, so we should at 
least figure out how to disable this warning so that it doesn't become 
annoying.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2005-01-20 10:18

Message:
Logged In: YES 
user_id=6656

Why is this a problem?  Is it not valid C or something?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1105699&group_id=5470


More information about the Python-bugs-list mailing list