unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Fabrice Popineau <fabrice.popineau@supelec.fr>
Cc: Eli Zaretskii <eliz@gnu.org>,
	ajmr@ilovetortilladepatatas.com, emacs-devel@gnu.org
Subject: Re: Windows 64 port
Date: Thu, 01 Mar 2012 00:58:02 -0800	[thread overview]
Message-ID: <4F4F3A1A.4020808@cs.ucla.edu> (raw)
In-Reply-To: <CAFgFV9Pbd7qXgd9M8dtwFW0_O8Uj27TqiTSQZv_O34CvvYgn0Q@mail.gmail.com>

On 02/29/2012 11:24 PM, Fabrice Popineau wrote:

>     For example, src/s/ms-w32.h can do something like this:
> 
>       /* Include <time.h> before defining tzname, to avoid DLL clash.  */
>       #include <time.h>
>       #define tzname _tzname
> 
>     This should avoid the diagnostic, since tzname isn't defined until
>     after <time.h> is included.

> What you propose didn't work (resulting in either : some function
> returns an array, that is tzname, or _tzname being undefined at link
> time).

Sorry, I don't follow.  What exactly happens when you try the above
suggestion, and why?  And what does this have to do with functions
returning arrays?

Perhaps you can explain, by showing the preprocessor output of
the failed attempt.

> the definition needs to be put somewhere because an int is not the same
> size as a pointer in windows 64.

OK, thanks, it appears you fixed that in a different way in the last
patch, so the point is moot.

> unless the source code is fixed to avois the warnings,
> it gets me a cleaner compilation listing.

Surely there's some way to tell the compiler to not issue the warnings.
Or you can simply ignore these bogus messages.

>     Here is a more-detailed review of the latest patch you sent.
> 
>     > -      int i = 0, aligned = (intptr_t) ABLOCKS_BUSY (abase);
>     > +      int i = 0, aligned = (ABLOCKS_BUSY (abase) != NULL);
> 
>     Not needed for Windows 64.  The change slows the code down a bit, and
> 
> 
> Prove it.

I compiled it both ways (x86-64 GCC 4.6.2), and the "!= NULL" version
has an extra "cmpl" instruction, so it is indeed a bit fatter.

>     it might not work on unusual hosts that have filler bits in their
>     pointers.
> 
> The it is because the compiler is buggy, because this is a perfectly legal and much more
> right than the double cascading cast (one explicit,  one implicit).

Sorry, it sounds like my suggestion wasn't clear.  On some
architectures, pointers have unused bits, there are multiple
representations of NULL, and the test for whether a pointer is NULL is
not the same as testing whether its bit-pattern is all zeros.
Compilers on such systems are not buggy: they are simply implementing
the machine's architecture.

Admittedly this point is probably theoretical.  As far as I know among
Emacs targets only the s390 architecture has unused bits in its
pointers, and I don't know whether its comparisons to NULL ignore
those bits.  Still, the point remains that one must be careful when
making changes like this, and there's no need for this particular
change for the Windows 64 port.

>     Not needed for Windows 64, since the arguments are all in int range.
> 
> Who knows that ? Certainly not the compiler.

*You* know it, because I just told you.  (:-)  I've read the code.

Similarly for your other remarks about the compiler not knowing
things.  In all these cases, the compiler may not be smart enough to
figure things out, but the values are indeed in range and there's no
need to alter the types.

>     > -             make_gap (-(nextb->text->gap_size - size));
>     > +             make_gap ((size - nextb->text->gap_size));
> 
>     Not needed for Windows 64, since the expressions are equivalent.
> 
> Depends on signed/unsigned. 

On Windows 64 the two expressions are equivalent, so there's no need
for this patch in the Windows 64 port.

>     > -  unsigned long int adj;
>     > +  intptr_t adj;
> 
>     Not needed for Windows 64; the value is always in unsigned long range.
> 
> I thank you for all those intptr_t -> uintptr_t catches.

You're welcome, but this is not an example of that.  The declaration
does not need to be changed, because the value of 'adj' is always
in the range 0..ULONG_MAX, on Windows 64 and on mainline hosts.

>     > +#ifdef min
>     > +#undef min
>     > +#endif
> 
> Just because it is redefined when it is a commonly defined macro in
> system headers.

Which system header defined it, and what exactly was it defined to?
If a system header defines 'min' it may not be wise to change it.

>     > -    unsigned long int magic; /* Magic number to check header integrity.  */
>     > +    uint64_t magic;  /* Magic number to check header integrity.  */
> 
>     Not needed for Windows 64, since the magic number fits in 32 bits.
> 
> If it is a 32bits integer, then better make it this way everywhere.

Perhaps -- but then why use uint64_t for a 32-bit quantity?
And anyway, the patch is not needed for Windows 64, regardless of what
type (if any) is substituted for unsigned long.

> I'm not even sure why there is a __malloc_ptrdiff_t at all.

It's a relic of the older pre-C89 environment.  These days we
should just remove __malloc_ptrdiff_t and use ptrdiff_t.
(But as part of a separate patch; it's not needed for Windows 64.)




  reply	other threads:[~2012-03-01  8:58 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19 20:18 Windows 64 port AJMR
2012-02-19 21:26 ` Eli Zaretskii
2012-02-19 22:05   ` Fabrice Popineau
2012-02-20  3:53     ` Eli Zaretskii
2012-02-20 17:48     ` Paul Eggert
2012-02-20 19:20       ` Fabrice Popineau
2012-02-20 20:43         ` Paul Eggert
2012-02-20 20:58           ` Eli Zaretskii
2012-02-20 23:11             ` Fabrice Popineau
2012-02-20 23:46               ` Paul Eggert
2012-02-21 13:22         ` Stefan Monnier
2012-02-21 18:26           ` Paul Eggert
2012-02-22 10:39         ` Richard Stallman
2012-02-22 16:27           ` Eli Zaretskii
2012-02-23 18:44             ` Richard Stallman
2012-02-23 19:16               ` Aurélien
2012-02-23 19:50                 ` Lennart Borgman
2012-02-23 20:48                 ` Fabrice Popineau
2012-02-24  5:52                   ` Aurélien
2012-02-28 21:00       ` Fabrice Popineau
2012-02-28 22:09         ` Paul Eggert
2012-02-28 22:39           ` Fabrice Popineau
2012-02-29 18:08             ` Eli Zaretskii
2012-02-29 22:08               ` Paul Eggert
2012-02-29 18:04           ` Eli Zaretskii
2012-02-29 19:43             ` Paul Eggert
2012-02-29 21:24               ` Eli Zaretskii
2012-03-01  3:34                 ` Paul Eggert
2012-03-01  4:03                   ` Eli Zaretskii
2012-03-01  6:28                     ` Paul Eggert
2012-03-01  7:04                       ` Fabrice Popineau
2012-03-22 17:31               ` Fabrice Popineau
2012-03-23 18:26                 ` Paul Eggert
2012-03-24  9:27                   ` Fabrice Popineau
2012-03-22 17:39           ` Fabrice Popineau
2012-03-22 18:02             ` Andreas Schwab
2012-03-22 18:34               ` Fabrice Popineau
2012-03-22 22:46                 ` Andreas Schwab
2012-03-22 23:06                   ` Fabrice Popineau
2012-03-22 23:38                     ` Andreas Schwab
2012-03-23  8:12                       ` Eli Zaretskii
2012-03-23  9:45                         ` Andreas Schwab
2012-03-23 10:27                           ` Fabrice Popineau
2012-03-23 10:42                             ` Andreas Schwab
2012-03-23 12:21                             ` Eli Zaretskii
2012-03-23 10:11                         ` Fabrice Popineau
2012-03-23 18:13                           ` Paul Eggert
2012-02-20 20:47     ` Eli Zaretskii
2012-02-26 20:17       ` AJMR
2012-02-26 21:25         ` Eli Zaretskii
2012-02-27 17:37           ` AJMR
2012-02-28 21:32       ` Fabrice Popineau
2012-03-01  3:23         ` Paul Eggert
2012-03-01  7:24           ` Fabrice Popineau
2012-03-01  8:58             ` Paul Eggert [this message]
2012-03-01 17:45               ` Eli Zaretskii
2012-03-01 20:05               ` Fabrice Popineau
2012-03-02  9:22               ` Eli Zaretskii
2012-03-02 20:35                 ` Paul Eggert
2012-03-02 21:32                   ` Fabrice Popineau
2012-03-02 22:06                   ` Eli Zaretskii
2012-03-03  5:42                     ` Paul Eggert
2012-03-03  7:18                       ` Eli Zaretskii
2012-03-04 21:48                         ` Paul Eggert
2012-03-03  7:58             ` Eli Zaretskii
2012-03-10 13:43               ` Eli Zaretskii
2012-03-22 17:15           ` Fabrice Popineau
2012-03-22 17:22           ` Fabrice Popineau
2012-03-22 18:29           ` Fabrice Popineau
2012-03-22 20:53             ` Stefan Monnier
2012-03-27 12:47           ` Fabrice Popineau
2012-03-27 16:08             ` Paul Eggert
2012-02-20  9:41 ` Richard Stallman
2012-02-20 10:28   ` Dani Moncayo
2012-02-21 12:10     ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4F4F3A1A.4020808@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=ajmr@ilovetortilladepatatas.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=fabrice.popineau@supelec.fr \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).