public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Hans-Bernhard Bröker" <HBBroeker@t-online.de>
To: cygwin@cygwin.com
Subject: Re: ushort definition
Date: Mon, 09 Jan 2017 22:31:00 -0000	[thread overview]
Message-ID: <5920d91e-43c4-f57b-3711-e423879c6896@t-online.de> (raw)
In-Reply-To: <20b0921a-0c66-9429-7c88-41d312041feb@gmail.com>

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

  reply	other threads:[~2017-01-09 22:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 16:48 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 [this message]
2017-01-09 23:05           ` Marco Atzeri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5920d91e-43c4-f57b-3711-e423879c6896@t-online.de \
    --to=hbbroeker@t-online.de \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).