Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-13 Thread Jorge Teixeira via cfe-commits
Hubert, You're right about the *_MIN relationships, and I fixed them on the attached patch. As for the enums, since there we're not even testing if the literals are integers or fp numbers, and the Std. already reserves ranges for implementation-specific values for some macros, it felt more

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-13 Thread Hubert Tong via cfe-commits
Hi Jorge, Looks fine to me. I'll work on committing this (with minor changes) over the weekend. Basically, I intend to remove some extraneous parentheses and adjust the * _EPSILON, *_MIN and *_TRUE_MIN checks to reject values equal to 0. -- HT On Sat, Feb 13, 2016 at 2:33 PM, Jorge Teixeira

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-13 Thread Jorge Teixeira via cfe-commits
Thanks Hubert. I'm curious to see how you will handle corner cases without library support, such as unsigned/signed zero and 0+x cases, with abs(x) < EPS. How does the parser/preprocessor interpret fp literals that are too "precise" for that machine but are fine for other targets (cross compile)?

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-13 Thread Hubert Tong via cfe-commits
Hi Jorge, I do not intend to "overcomplicate" the testing as you put it, so there will be cases which are not caught by these tests. For *_MAX, if overflow occurs to the maximum positive finite value (assuming no infinities), then it is possible for that value to be less than 10^37 and the test

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-13 Thread Jorge Teixeira via cfe-commits
Hubert, Ok on keeping the tests simple. I removed the parentheses and transformed the fp checks into _Static_assert. JT On Sat, Feb 13, 2016 at 8:11 PM, Hubert Tong wrote: > On Sat, Feb 13, 2016 at 7:10 PM, Hubert Tong >

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-12 Thread Hubert Tong via cfe-commits
Thanks Jorge. I'll work on committing this today. -- HT On Fri, Feb 12, 2016 at 12:10 AM, Jorge Teixeira wrote: > Hubert, > > Thanks for the code review. Over the weekend I'll try to learn a bit > more about using Phabricator, but for now I'll reply here, and

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-12 Thread Jorge Teixeira via cfe-commits
Hi, I decided to strike while the iron was hot and add the remaining tests for float.h. 1) clang was missing the C11 mandatory *_HAS_SUBNORM macros, so I added them. The internal underscored versions are *_HAS_DENORM, and the Std. defines only "subnormal" and "unnormalized", so there could be,

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Jorge Teixeira via cfe-commits
Here is a revised test, which I renamed to c11-5_2_4_2_2p11.c instead of float.c because I am only checking a subset of what the standard mandates for float.h, and because there were similar precedents, like test/Preprocessor/c99-*.c. Feel free to override, though. The first part checks for basic

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Richard Smith via cfe-commits
Thanks, I modified the test to also test C89 and C99 modes and committed this as r260577. On Thu, Feb 11, 2016 at 11:29 AM, Jorge Teixeira wrote: > Here is a revised test, which I renamed to c11-5_2_4_2_2p11.c instead > of float.c because I am only checking a subset

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Richard Smith via cfe-commits
On Thu, Feb 11, 2016 at 3:42 PM, Jorge Teixeira wrote: > Richard, > > Thanks and got it re: test filename and hosted mode. > > 1) AFAIK, C89/C90 does not define DECIMAL_DIG, so here is a revised > patch, with minor comment modifications to explicitly list the (draft) >

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Richard Smith via cfe-commits
On Thu, Feb 11, 2016 at 4:53 PM, Jorge Teixeira wrote: >> You'll also need to change to only provide DECIMAL_DIG in C99 >> onwards. > Done! > >> All of our -std versions are that standard plus applicable Defect >> Reports. So -std=c89 includes TC1 and TC2, but not

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Jorge Teixeira via cfe-commits
> You'll also need to change to only provide DECIMAL_DIG in C99 > onwards. Done! > All of our -std versions are that standard plus applicable Defect > Reports. So -std=c89 includes TC1 and TC2, but not Amendment 1 (we > have -std=c94 for that, but the only difference from our C89 mode is > the

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Jorge Teixeira via cfe-commits
Richard, Thanks and got it re: test filename and hosted mode. 1) AFAIK, C89/C90 does not define DECIMAL_DIG, so here is a revised patch, with minor comment modifications to explicitly list the (draft) normative references that I used. 2) This might also be a good time to ask you what does clang

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Hubert Tong via cfe-commits
Hi Jorge, I responded to the initial commit with some comments here: http://reviews.llvm.org/rL260577 -- HT On Thu, Feb 11, 2016 at 7:53 PM, Jorge Teixeira wrote: > > You'll also need to change to only provide DECIMAL_DIG in C99 > onwards. > Done! > > > All of our

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-11 Thread Jorge Teixeira via cfe-commits
Hubert, Thanks for the code review. Over the weekend I'll try to learn a bit more about using Phabricator, but for now I'll reply here, and attach a new patch. a) *_MANT_DIG < 1 --> *_MANT_DIG < 2 That is a stricter check and I agree with your rationale. Done. b) _MIN_EXP --> FLT_MIN_EXP Done.

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-10 Thread Jorge Teixeira via cfe-commits
Richard, Can you be more specific? I assume you mean something like my newly attached .h file that tests very basic implementation compliance (i.e., it's required, but not sufficient), but I would need a bit more guidance about the structure of the file, how to perform the tests, and where to

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-09 Thread Hubert Tong via cfe-commits
I see no immediate issue with this patch, but I am not one of the usual reviewers for this part of the code base. -- HT On Tue, Feb 9, 2016 at 2:56 PM, Jorge Teixeira wrote: > Thanks Hubert. Somehow I omitted that prefix when typing the macros, > and I did not

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-09 Thread Jorge Teixeira via cfe-commits
Thanks Hubert. Somehow I omitted that prefix when typing the macros, and I did not noticed it when I was testing because on my arch DECIMAL_DIG is defined to be the LDBL version... Updated patch is attached. JT On Tue, Feb 9, 2016 at 1:41 PM, Hubert Tong

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-09 Thread Hubert Tong via cfe-commits
There is a __LDBL_DECIMAL_DIG__ predefined macro. __DECIMAL_DIG__ will not always be the same as __LDBL_DECIMAL_DIG__. -- HT On Mon, Feb 8, 2016 at 11:26 PM, Jorge Teixeira via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Hi, I filed the bug (https://llvm.org/bugs/show_bug.cgi?id=26283)

Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-09 Thread Jorge Teixeira via cfe-commits
Hi, I filed the bug (https://llvm.org/bugs/show_bug.cgi?id=26283) some time ago and nobody picked it up, so here is a trivial patch exposing the missing macros, that to the best of my ability were already present as the internal underscored versions. Perhaps a more general bug about C11 floating

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-09 Thread Richard Smith via cfe-commits
Patch looks good. Please also add a testcase to test/Headers. On Tue, Feb 9, 2016 at 12:08 PM, Hubert Tong via cfe-commits wrote: > I see no immediate issue with this patch, but I am not one of the usual > reviewers for this part of the code base. > > -- HT > > > On

Re: Patch for Bug 26283: float.h is missing mandatory C11 fp macros like DBL_DECIMAL_DIG and LDBL_DECIMAL_DIG

2016-02-09 Thread Richard Smith via cfe-commits
On Tue, Feb 9, 2016 at 2:43 PM, Jorge Teixeira wrote: > Richard, > > Can you be more specific? > > I assume you mean something like my newly attached .h file that tests > very basic implementation compliance (i.e., it's required, but not > sufficient), but I would need