Web lists-archives.com

Re: ushort definition




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