[PATCH xquartz 08/10] osinit: Silence -Wunused-variable warnings

Jeremy Huddleston Sequoia jeremyhu at apple.com
Wed Oct 14 15:48:08 PDT 2015


I thought we required C99 now.  Was I mistaken in that?  If not, I'm fine with just leaving it as is and ignoring the warning.

> On Oct 14, 2015, at 15:37, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:
> 
> I don't mind not having the declarations at the beginning of the block
> but will that make some other platforms with ancient compilers sad?
> (OpenBSD with old gcc?  Visual Studio on Windows?)
> 
> 	-alan-
> 
> On 10/14/15 03:13 PM, Jeremy Huddleston Sequoia wrote:
>> osinit.c:161:24: warning: unused variable 'devnull' [-Wunused-variable,Unused Entity Issue]
>>     static const char *devnull = "/dev/null";
>>                        ^
>> osinit.c:162:10: warning: unused variable 'fname' [-Wunused-variable,Unused Entity Issue]
>>     char fname[PATH_MAX];
>>          ^
>> 
>> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
>> ---
>>  os/osinit.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/os/osinit.c b/os/osinit.c
>> index ddd3fce..41a0aa7 100644
>> --- a/os/osinit.c
>> +++ b/os/osinit.c
>> @@ -158,8 +158,6 @@ void
>>  OsInit(void)
>>  {
>>      static Bool been_here = FALSE;
>> -    static const char *devnull = "/dev/null";
>> -    char fname[PATH_MAX];
>> 
>>      if (!been_here) {
>>  #if !defined(WIN32) || defined(__CYGWIN__)
>> @@ -219,6 +217,9 @@ OsInit(void)
>>  #endif
>> 
>>  #if !defined(XQUARTZ)    /* STDIN is already /dev/null and STDOUT/STDERR is managed by console_redirect.c */
>> +        static const char *devnull = "/dev/null";
>> +        char fname[PATH_MAX];
>> +
>>  # if defined(__APPLE__)
>>          int devnullfd = open(devnull, O_RDWR, 0);
>>          assert(devnullfd > 2);
>> 
> 
> 
> 
> -- 
> 	-Alan Coopersmith-              alan.coopersmith at oracle.com
> 	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4109 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20151014/3f9b7f84/attachment.bin>


More information about the xorg-devel mailing list