tgmath.h

Hello:

I have made some changes to tgmath.h. There could be seen repetitive definitions, so I defined some macros in order to add some structure there and make the file smaller and, in my opinion, more readable. I also added a test to see if the implementatinos suports complex numbers and surrounded the code that uses those types under the corresponding #ifdef #endif.

That way tgmath can be used with, say, VS 2010, which is the one I am using, so far without any problem.

If nobody spots a bug in the following days I may upload the file, is it right?

Regards,

Javier A. Múgica

tgmath.h (16.3 KB)

Hi,

I'm not suitable to review the change but there's a couple things I can comment on to help you get your change reviewed.

That way tgmath can be used with, say, VS 2010, which is the one I am using,
so far without any problem.

I believe there was a policy decision to support only the last two major releases of GCC, Clang, and Visual Studio and our getting started page (http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library) lists Visual Studio 2013 as being the minimum supported version. At the time the decision was made, this was necessary to be able to migrate to C++11.

If nobody spots a bug in the following days I may upload the file, is it right?

Generally speaking, you'll need to wait for someone to review your patch and approve it. You'll need to send a patch to cfe-commits rather than attach your modified file though. At the moment, it's difficult to tell what changes you made.

Please see http://llvm.org/docs/DeveloperPolicy.html#making-and-submitting-a-patch and http://llvm.org/docs/DeveloperPolicy.html#code-reviews for more information.

Hope that helps

One thing is the version of Visual Studio required for compiling Clang and another one the libraries with which Clang can be used. Since I have VS 2010, and I saw Visual Studio 2013 as being the minimum required version, I downloaded VS 2105 and built clang. Now I use clang with the VS 2010 libraries, and all my C projects have been compiled successfully. Note that only some headers form the VS 2010 distribution and the crt dll's are needed, so I can use in my code any feature not suported by VS 2010 as long as Clang supports it, so I can take advantage of most, if not all, C99 and C11 features even if I use VS 2010.

At any rate, support for complex numbers has been made optional in C11, so the guard is necessary. The other changes are not intended to be functional changes, just defining more helper macros for writing the repetitive generic function definitions. I will send a message to the cfe-commits as you explained me. thank you for your instructions.

Regards

From: Javier Múgica [mailto:javier_3@runbox.com]
Sent: 09 June 2015 11:52
To: cfe-dev
Cc: Daniel Sanders
Subject: Re: [cfe-dev] tgmath.h

> Hi,
>
> I'm not suitable to review the change but there's a couple things I can
comment on to help you get your change reviewed.
>
> > That way tgmath can be used with, say, VS 2010, which is the one I am
using,
> > so far without any problem.
>
> I believe there was a policy decision to support only the last two major
releases of GCC, Clang, and Visual Studio and our getting started page
(http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-
and-standard-library) lists Visual Studio 2013 as being the minimum
supported version. At the time the decision was made, this was necessary to
be able to migrate to C++11.

One thing is the version of Visual Studio required for compiling Clang and
another one the libraries with which Clang can be used. Since I have VS 2010,
and I saw Visual Studio 2013 as being the minimum required version, I
downloaded VS 2105 and built clang. Now I use clang with the VS 2010
libraries, and all my C projects have been compiled successfully. Note that
only some headers form the VS 2010 distribution and the crt dll's are needed,
so I can use in my code any feature not suported by VS 2010 as long as Clang
supports it, so I can take advantage of most, if not all, C99 and C11 features
even if I use VS 2010.

That makes sense to me. Thanks for explaining.

At any rate, support for complex numbers has been made optional in C11, so
the guard is necessary. The other changes are not intended to be functional
changes, just defining more helper macros for writing the repetitive generic
function definitions. I will send a message to the cfe-commits as you
explained me. thank you for your instructions.

Regards

No problem.

Hi,

I'm not suitable to review the change but there's a couple things I can
comment on to help you get your change reviewed.

> That way tgmath can be used with, say, VS 2010, which is the one I am
using,
> so far without any problem.

I believe there was a policy decision to support only the last two major
releases of GCC, Clang, and Visual Studio and our getting started page (
http://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library)
lists Visual Studio 2013 as being the minimum supported version. At the
time the decision was made, this was necessary to be able to migrate to
C++11.

The tgmath.h in clang/lib/Headers/tgmath.h is one of clang's builtin
headers. They are used while compiling users' code, not while compiling
clang itself. Clang is the only compiler that is ever intended to see these
headers.

-- Sean Silva

Yes, the configuration is clang targeting the MSVC 2010 runtime, which is
supported relatively well. The MSVC 2010 runtime is lacking some math
functions. I expect Javier will send along a diff which will make it easier
to identify the issue.

Good point. I was just trying to dispel any confusion regarding
host-vs-target system requirements.

-- Sean Silva