[prev in list] [next in list] [prev in thread] [next in thread]
List: pcc-list
Subject: Re: Warning in NetBSD' stdio.h
From: Alt <alt () altamiranus ! info>
Date: 2010-08-31 23:42:58
Message-ID: AANLkTimZ1x-EC0JA8zcREG=_07M5ck=POQhqvj_yvBRh () mail ! gmail ! com
[Download RAW message or body]
I found out it's caused by the "-Wtruncate" flag, which is enabled
when building with PCC.
I am confused, though. I have searched the GCC documentation and
haven't found any place where converting from one datatype to another
would be considered an error. (In particular, I've researched the
-Wextra, -Wconversion, -Wsign-compare, and -Wsign-conversion flags.)
It does warn you when attempting to assign values between signed and
unsigned datatypes. So who's at fault here, PCC or the BSDs?
--
.alt.
On Thu, Aug 26, 2010 at 8:46 PM, Jesus Sanchez <zexel_ut@hotmail.com> wrote:
>
> El 27/08/2010 1:39, Alt escribió:
>>
>> Hi there,
>>
>> When compiling pcc with itself under NetBSD 5.0.2, I get multiple
>> instances of the following warning:
>>
>> /usr/include//stdio.h, line 443: warning: conversion to 'unsigned
>> char' from 'int' may alter its value
>>
>> I do not get these warnings when building with GCC, though.
>>
>> Here's the relevant portion of stdio.h:
>>
>> /usr/include/stdio.h:
>> ---- quoted content below ----
>> typedef struct __sFILE {
>> unsigned char *_p; /* current position in (some) buffer
>> */
>> /* other fields follow */
>> } FILE;
>>
>> /* then below .... */
>> #if defined(__GNUC__)&& defined(__STDC__)
>> static __inline int __sputc(int _c, FILE*_p) {
>> if (--_p->_w>= 0 || (_p->_w>= _p->_lbfsize&& (char)_c != '\n'))
>> return(*_p->_p++ = _c); /*<-- this is line 443
>> */
>> else
>> return(__swbuf(_c, _p));
>> }
>> ---- quoted content above ----
>>
>> (The full file is available through CVSweb at the NetBSD Projects' page.)
>>
>> This is ancient code, shared by OpenBSD and FreeBSD. I'm wondering if
>> I'm the only one seeing this (and worrying about it.)
>>
>
> same here with OpenBSD -current.
>
> -J
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic