public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* ushort definition
@ 2017-01-09 16:48 Marco Atzeri
  2017-01-09 16:59 ` Corinna Vinschen
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Atzeri @ 2017-01-09 16:48 UTC (permalink / raw)
  To: cygwin

While building latest gdal

the following bloc of
/usr/include/sys/types.h

-----------------------------------------------------------------------
#if __MISC_VISIBLE
typedef unsigned short  ushort;         /* System V compatibility */
typedef unsigned int    uint;           /* System V compatibility */
typedef unsigned long   ulong;          /* System V compatibility */
#endif
-------------------------------------------------------------------------

seems to cause a puzzling recursive definition
(as reported by g++ -C -E)

$ grep "System V" ../o/.libs/jpeg2000_vsil_io.E
typedef unsigned short unsigned short; /* System V compatibility */
typedef unsigned int unsigned int; /* System V compatibility */
typedef unsigned long unsigned long; /* System V compatibility */
  * from System V, which stupidly took internal interface macros and

however I don't see how the definition is read two times
or where ushort was previoulsy defined.

grep "ushort" ../o/.libs/jpeg2000_vsil_io.E
<empty>

What I am missing ?

Regards
Marco

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ushort definition
  2017-01-09 16:48 ushort definition Marco Atzeri
@ 2017-01-09 16:59 ` Corinna Vinschen
  2017-01-09 17:48   ` Marco Atzeri
  0 siblings, 1 reply; 7+ messages in thread
From: Corinna Vinschen @ 2017-01-09 16:59 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1360 bytes --]

On Jan  9 17:47, Marco Atzeri wrote:
> While building latest gdal
> 
> the following bloc of
> /usr/include/sys/types.h
> 
> -----------------------------------------------------------------------
> #if __MISC_VISIBLE
> typedef unsigned short  ushort;         /* System V compatibility */
> typedef unsigned int    uint;           /* System V compatibility */
> typedef unsigned long   ulong;          /* System V compatibility */
> #endif
> -------------------------------------------------------------------------
> 
> seems to cause a puzzling recursive definition
> (as reported by g++ -C -E)
> 
> $ grep "System V" ../o/.libs/jpeg2000_vsil_io.E
> typedef unsigned short unsigned short; /* System V compatibility */
> typedef unsigned int unsigned int; /* System V compatibility */
> typedef unsigned long unsigned long; /* System V compatibility */
>  * from System V, which stupidly took internal interface macros and
> 
> however I don't see how the definition is read two times
> or where ushort was previoulsy defined.
> 
> grep "ushort" ../o/.libs/jpeg2000_vsil_io.E
> <empty>
> 
> What I am missing ?

Some

  #define ushort unsigned short

perhaps?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ushort definition
  2017-01-09 16:59 ` Corinna Vinschen
@ 2017-01-09 17:48   ` Marco Atzeri
  2017-01-09 18:02     ` Hans-Bernhard Bröker
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Atzeri @ 2017-01-09 17:48 UTC (permalink / raw)
  To: cygwin

On 09/01/2017 17:59, Corinna Vinschen wrote:
> On Jan  9 17:47, Marco Atzeri wrote:
>> While building latest gdal
>>
>> the following bloc of
>> /usr/include/sys/types.h
>>
>> -----------------------------------------------------------------------
>> #if __MISC_VISIBLE
>> typedef unsigned short  ushort;         /* System V compatibility */
>> typedef unsigned int    uint;           /* System V compatibility */
>> typedef unsigned long   ulong;          /* System V compatibility */
>> #endif
>> -------------------------------------------------------------------------
>>
>> seems to cause a puzzling recursive definition
>> (as reported by g++ -C -E)
>>
>> $ grep "System V" ../o/.libs/jpeg2000_vsil_io.E
>> typedef unsigned short unsigned short; /* System V compatibility */
>> typedef unsigned int unsigned int; /* System V compatibility */
>> typedef unsigned long unsigned long; /* System V compatibility */
>>  * from System V, which stupidly took internal interface macros and
>>
>> however I don't see how the definition is read two times
>> or where ushort was previoulsy defined.
>>
>> grep "ushort" ../o/.libs/jpeg2000_vsil_io.E
>> <empty>
>>
>> What I am missing ?
>
> Some
>
>   #define ushort unsigned short
>
> perhaps?
>
>
> Corinna
>

I expect should appear on g++ -C -E output,
but instead nothing

grep "ushort" ../o/.libs/jpeg2000_vsil_io.E





--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ushort definition
  2017-01-09 17:48   ` Marco Atzeri
@ 2017-01-09 18:02     ` Hans-Bernhard Bröker
  2017-01-09 19:47       ` Marco Atzeri
  0 siblings, 1 reply; 7+ messages in thread
From: Hans-Bernhard Bröker @ 2017-01-09 18:02 UTC (permalink / raw)
  To: cygwin

Am 09.01.2017 um 18:48 schrieb Marco Atzeri:
> On 09/01/2017 17:59, Corinna Vinschen wrote:

>> Some
>>
>>   #define ushort unsigned short
>>
>> perhaps?

> I expect should appear on g++ -C -E output,

That expectation would only be justified if you added the option `-dD' 
to your command.

`-C' only preserves comments, but not the #define in the source.




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ushort definition
  2017-01-09 18:02     ` Hans-Bernhard Bröker
@ 2017-01-09 19:47       ` Marco Atzeri
  2017-01-09 22:31         ` Hans-Bernhard Bröker
  0 siblings, 1 reply; 7+ messages in thread
From: Marco Atzeri @ 2017-01-09 19:47 UTC (permalink / raw)
  To: cygwin

On 09/01/2017 19:01, Hans-Bernhard Bröker wrote:
> Am 09.01.2017 um 18:48 schrieb Marco Atzeri:
>> On 09/01/2017 17:59, Corinna Vinschen wrote:
>
>>> Some
>>>
>>>   #define ushort unsigned short
>>>
>>> perhaps?
>
>> I expect should appear on g++ -C -E output,
>
> That expectation would only be justified if you added the option `-dD'
> to your command.
>
> `-C' only preserves comments, but not the #define in the source.
>

Thanks Hans,
I was missing that.

the "#define ushort unsigned short" is in the
/usr/include/jasper/jas_config.h

It seems jasper configuration had not defined __MISC_VISIBLE,
while gdal does.

I do not see an easy way to overcome the problem except
disabling the jasper interface or rebuild jasper with defined 
__MISC_VISIBLE.


Regards
Marco

















--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ushort definition
  2017-01-09 19:47       ` Marco Atzeri
@ 2017-01-09 22:31         ` Hans-Bernhard Bröker
  2017-01-09 23:05           ` Marco Atzeri
  0 siblings, 1 reply; 7+ messages in thread
From: Hans-Bernhard Bröker @ 2017-01-09 22:31 UTC (permalink / raw)
  To: cygwin

Am 09.01.2017 um 20:46 schrieb Marco Atzeri:
> On 09/01/2017 19:01, Hans-Bernhard Bröker wrote:

>> That expectation would only be justified if you added the option `-dD'
>> to your command.
>>
>> `-C' only preserves comments, but not the #define in the source.
>>
>
> Thanks Hans,
> I was missing that.

FWIW, in cases like this, at least for 'automake' equipped projects, I 
would probably just 'make cscope' and then used the '1' query to find 
all definitions of 'ushort' visible to the source.  Letting automake 
build the database makes sure all the include paths are in.  But then 
again, I'm evidently biased, having been cscope's maintainer for quite a 
while now ;-)

> the "#define ushort unsigned short" is in the
> /usr/include/jasper/jas_config.h
>
> It seems jasper configuration had not defined __MISC_VISIBLE,
> while gdal does.

Neither is supposed to #define __MISC_VISIBLE itself.  cscope finds:

$ cscope -dL1 __MISC_VISIBLE
/usr/include/sys/features.h __MISC_VISIBLE 276 #define __MISC_VISIBLE 1
/usr/include/sys/features.h __MISC_VISIBLE 278 #define __MISC_VISIBLE 0

So let's look at a bit of context:

$ sed -n -e '270,280p' /usr/include/sys/features.h
#define __LARGEFILE_VISIBLE     1
#else
#define __LARGEFILE_VISIBLE     0
#endif

#ifdef _DEFAULT_SOURCE
#define __MISC_VISIBLE          1
#else
#define __MISC_VISIBLE          0
#endif

I.e. if jasper didn't have __MISC_VISIBLE on, it must have overridden 
the default feature test state of _DEFAULT_SOURCE.

The lesson to be had from all this: #defining types is just wrong. Don't 
do it.  typedef exists to be used.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ushort definition
  2017-01-09 22:31         ` Hans-Bernhard Bröker
@ 2017-01-09 23:05           ` Marco Atzeri
  0 siblings, 0 replies; 7+ messages in thread
From: Marco Atzeri @ 2017-01-09 23:05 UTC (permalink / raw)
  To: cygwin

On 09/01/2017 23:30, Hans-Bernhard Bröker wrote:
> Am 09.01.2017 um 20:46 schrieb Marco Atzeri:
>> On 09/01/2017 19:01, Hans-Bernhard Bröker wrote:
>
>
>> the "#define ushort unsigned short" is in the
>> /usr/include/jasper/jas_config.h
>>
>> It seems jasper configuration had not defined __MISC_VISIBLE,
>> while gdal does.
>
> Neither is supposed to #define __MISC_VISIBLE itself.  cscope finds:
>
> $ cscope -dL1 __MISC_VISIBLE
> /usr/include/sys/features.h __MISC_VISIBLE 276 #define __MISC_VISIBLE 1
> /usr/include/sys/features.h __MISC_VISIBLE 278 #define __MISC_VISIBLE 0
>
> So let's look at a bit of context:
>
> $ sed -n -e '270,280p' /usr/include/sys/features.h
> #define __LARGEFILE_VISIBLE     1
> #else
> #define __LARGEFILE_VISIBLE     0
> #endif
>
> #ifdef _DEFAULT_SOURCE
> #define __MISC_VISIBLE          1
> #else
> #define __MISC_VISIBLE          0
> #endif
>
> I.e. if jasper didn't have __MISC_VISIBLE on, it must have overridden
> the default feature test state of _DEFAULT_SOURCE.

I will bet on a "-std=C99" somewhere

> The lesson to be had from all this: #defining types is just wrong. Don't
> do it.  typedef exists to be used.

Thanks again
Marco





--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-09 23:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 16:48 ushort definition Marco Atzeri
2017-01-09 16:59 ` Corinna Vinschen
2017-01-09 17:48   ` Marco Atzeri
2017-01-09 18:02     ` Hans-Bernhard Bröker
2017-01-09 19:47       ` Marco Atzeri
2017-01-09 22:31         ` Hans-Bernhard Bröker
2017-01-09 23:05           ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).