This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Warnings in Python.h with gcc 4.0.0
Type: Stage:
Components: Build Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: bob.ippolito, loewis, mwh, rjk1002, tim.peters
Priority: normal Keywords:

Created on 2005-01-20 00:52 by bob.ippolito, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (9)
msg23993 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2005-01-20 00:52
(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 *);
msg23994 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2005-01-20 15:18
Logged In: YES 
user_id=6656

Why is this a problem?  Is it not valid C or something?
msg23995 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2005-01-20 22:49
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.
msg23996 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-01-20 23:13
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>.
msg23997 - (view) Author: Richard Kettlewell (rjk1002) Date: 2005-01-31 15:43
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.
msg23998 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-03-04 20:15
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.
msg23999 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2005-03-14 22:52
Logged In: YES 
user_id=139309

Turns out that this is a GCC4 bug (not sure which, though).  The OS 
headers are fine.
msg24000 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-03-15 08:06
Logged In: YES 
user_id=21627

Still, for the record: what operating system is this on?

I don't believe the analysis that this is a GCC bug, but I'm
willing to accept it <wink>. Closing this as third-party.
msg24001 - (view) Author: Bob Ippolito (bob.ippolito) * (Python committer) Date: 2005-03-15 08:42
Logged In: YES 
user_id=139309

It is most certainly a GCC bug (remember, this is GCC 4).

I'm not sure I can say which OS it is, due to NDA, but it shouldn't be hard 
to guess.  The release I'm using is not public.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41463
2005-01-20 00:52:38bob.ippolitocreate