Re: Move -DNO_ASM to config.h?

2016-03-22 Thread Vincent Lefevre
On 2016-03-21 16:01:25 +0100, Marc Glisse wrote:
> In https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69134 (
> https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00127.html ), users
> specifically wanted to disable MPFR's copy ;-)

That's because they're using a very old MPFR version (2.4.2).
Normally, the right thing to do if this happened in a recent
version would be to fix the bug.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-21 Thread Marc Glisse

On Mon, 21 Mar 2016, Vincent Lefevre wrote:


On 2016-03-20 12:14:49 +0100, Marc Glisse wrote:

but it seems likely that a user who went to the trouble of disabling
assembly for GMP doesn't want to use that same assembly in MPFR.


I'm not so sure about that. AFAIK, longlong.h has far less asm code
than the whole GMP. So, it is less likely that a user would want to
disable asm from MPFR's copy of longlong.h.


In https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69134 ( 
https://gcc.gnu.org/ml/gcc-patches/2016-01/msg00127.html ), users 
specifically wanted to disable MPFR's copy ;-)



On the other hand, MPFR could probably add a --disable-assembly
configure flag to define NO_ASM, so the user would just have to pass
the same option to MPFR that he already passed to GMP.


I don't think that such an option would really be useful (unless
there is a demand for it). The user could still pass -DNO_ASM in
CFLAGS. The drawback is that the user won't benefit from the default
CFLAGS, but if he wants -DNO_ASM, this is quite specific so that he
may not need the default CFLAGS anyway.


Ok. I guess I saw --disable-assembly mostly as a way to document this, but 
probably NO_ASM is not worth documenting in MPFR.


--
Marc Glisse
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-21 Thread Vincent Lefevre
On 2016-03-20 12:14:49 +0100, Marc Glisse wrote:
> I am guessing that, just like they want to use the exact same flags as GMP
> to compile (__GMP_CFLAGS), they also want to mimic this part of the build
> process. I don't know if their version of longlong.h is kept in sync with
> GMP's,

We try to keep it in sync, but there's no strict dependency between
MPFR and GMP (MPFR just requires some minimal version of GMP, but
in practice, not the latest).

> but it seems likely that a user who went to the trouble of disabling
> assembly for GMP doesn't want to use that same assembly in MPFR.

I'm not so sure about that. AFAIK, longlong.h has far less asm code
than the whole GMP. So, it is less likely that a user would want to
disable asm from MPFR's copy of longlong.h.

> On the other hand, MPFR could probably add a --disable-assembly
> configure flag to define NO_ASM, so the user would just have to pass
> the same option to MPFR that he already passed to GMP.

I don't think that such an option would really be useful (unless
there is a demand for it). The user could still pass -DNO_ASM in
CFLAGS. The drawback is that the user won't benefit from the default
CFLAGS, but if he wants -DNO_ASM, this is quite specific so that he
may not need the default CFLAGS anyway.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Marc Glisse

On Sun, 20 Mar 2016, Torbjörn Granlund wrote:


Marc Glisse  writes:

 I currently think I'll go with just config.h (no CFLAGS).

sgtm


https://gmplib.org/repo/gmp/rev/a70e6b446199

I tested it some and it seemed to work...

--
Marc Glisse
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Torbjörn Granlund
Marc Glisse  writes:

  I currently think I'll go with just config.h (no CFLAGS).

sgtm

-- 
Torbjörn
Please encrypt, key id 0xC8601622
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Marc Glisse

On Sun, 20 Mar 2016, Torbjörn Granlund wrote:


Marc Glisse  writes:

 One issue with changing it is MPFR: src/mpfr-longlong.h tests for
 NO_ASM, but there is no code to define it. As far as I understand,
 MPFR uses __GMP_CFLAGS by default, in which GMP may have included
 -DNO_ASM. If we move NO_ASM to config.h, that also affects them (not
 that it should necessarily stop us). We could also define NO_ASM both
 in CFLAGS and config.h. It looks like gcc and clang only warn when
 redefining a macro to something different, they don't warn for
 -DNO_ASM with #define NO_ASM 1, so it wouldn't be so bad.

In what way is it relevant to MPFR whether a GMP build included asm or
not?


I am guessing that, just like they want to use the exact same flags as GMP 
to compile (__GMP_CFLAGS), they also want to mimic this part of the build 
process. I don't know if their version of longlong.h is kept in sync with 
GMP's, but it seems likely that a user who went to the trouble of 
disabling assembly for GMP doesn't want to use that same assembly in MPFR. 
On the other hand, MPFR could probably add a --disable-assembly configure 
flag to define NO_ASM, so the user would just have to pass the same option 
to MPFR that he already passed to GMP.


I currently think I'll go with just config.h (no CFLAGS).

--
Marc Glisse
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Torbjörn Granlund
Marc Glisse  writes:

  One issue with changing it is MPFR: src/mpfr-longlong.h tests for
  NO_ASM, but there is no code to define it. As far as I understand,
  MPFR uses __GMP_CFLAGS by default, in which GMP may have included
  -DNO_ASM. If we move NO_ASM to config.h, that also affects them (not
  that it should necessarily stop us). We could also define NO_ASM both
  in CFLAGS and config.h. It looks like gcc and clang only warn when
  redefining a macro to something different, they don't warn for
  -DNO_ASM with #define NO_ASM 1, so it wouldn't be so bad.

In what way is it relevant to MPFR whether a GMP build included asm or
not?

-- 
Torbjörn
Please encrypt, key id 0xC8601622
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Marc Glisse

On Sat, 19 Mar 2016, Marc Glisse wrote:

when configure wants to define a macro, it usually puts it in config.h. We do 
have one exception: NO_ASM, which ends up defined in CFLAGS. Was there a 
particular reason for this choice?


One issue with changing it is MPFR: src/mpfr-longlong.h tests for NO_ASM, 
but there is no code to define it. As far as I understand, MPFR uses 
__GMP_CFLAGS by default, in which GMP may have included -DNO_ASM. If we 
move NO_ASM to config.h, that also affects them (not that it should 
necessarily stop us). We could also define NO_ASM both in CFLAGS and 
config.h. It looks like gcc and clang only warn when redefining a macro to 
something different, they don't warn for -DNO_ASM with #define NO_ASM 1, 
so it wouldn't be so bad.


--
Marc Glisse
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Marc Glisse

On Sun, 20 Mar 2016, Niels Möller wrote:


Marc Glisse  writes:


when configure wants to define a macro, it usually puts it in
config.h. We do have one exception: NO_ASM, which ends up defined in
CFLAGS. Was there a particular reason for this choice?


I'm greping for its uses, and it is used only in C files as far as I
can see.


I sure hope we don't use NO_ASM inside asm files ;-)
I was wondering if it was useful in the rest of the configure script, but 
it seems to be done late enough that it is unlikely.



Moving it to config.h makes sense to me. If we move it, we have make
sure that config.h is always included before longlong.h. Most files get
config.h via gmp-impl.h. So, e.g., #include "longlong.h" followed by
#include "gmp-impl.h" would break.


longlong.h requires some types like UWtype which we provide in gmp-impl.h, 
so I am hoping that the inclusions are already handled properly.



I think the autoconf manual recommends an explicit include of config.h
(guarded by HAVE_CONFIG_H) first in every C file. We don't have to do it
that way of course, just be aware that we depart from that convention.


Thanks. autoconf is still rather unfamiliar to me (though at least it 
makes more sense than the cmake I am forced to use at work).


--
Marc Glisse
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Re: Move -DNO_ASM to config.h?

2016-03-20 Thread Niels Möller
Marc Glisse  writes:

> when configure wants to define a macro, it usually puts it in
> config.h. We do have one exception: NO_ASM, which ends up defined in
> CFLAGS. Was there a particular reason for this choice?

I'm greping for its uses, and it is used only in C files as far as I
can see. 

Moving it to config.h makes sense to me. If we move it, we have make
sure that config.h is always included before longlong.h. Most files get
config.h via gmp-impl.h. So, e.g., #include "longlong.h" followed by
#include "gmp-impl.h" would break. 

I think the autoconf manual recommends an explicit include of config.h
(guarded by HAVE_CONFIG_H) first in every C file. We don't have to do it
that way of course, just be aware that we depart from that convention.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel


Move -DNO_ASM to config.h?

2016-03-19 Thread Marc Glisse

Hello,

when configure wants to define a macro, it usually puts it in config.h. We 
do have one exception: NO_ASM, which ends up defined in CFLAGS. Was there 
a particular reason for this choice?


When gcc compiles gmp as part of its bootstrap, it calls:
make CFLAGS=-g OTHER_FLAGS=... etc
which overrides the definition of NO_ASM and fails quite badly.

I don't like what gcc is doing there, but it made me aware of this special 
handling for the macro NO_ASM.


--
Marc Glisse
___
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel