-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_Float128 handling seems to be still broken #43
Comments
So, it seems the bug can be resolved by one of the following:
|
Ok, I do understand that language-c is now incompatible with code that defines a typedef _Float128. |
The GLIBC announcement says:
And after a closer look, it seems that assuming it as a |
Ping? Will this issue be resolved? |
This issue is hard to resolve if you want a "magic" solution that does not ask the language-c client to choose whether _Float128 should be a builtin typedef. As said before, it would be feasible, although a major change, to remove _Float128 from the lexer and add it to the list of builtin typedefs, and then add a way to select whether _Float128 is a builtin typedef. The major change is that selecting different C dialects is not supported at the moment, so you need a new API. I guess that is not a realistic option. For the users that are affected because they use glib >= 2.26 and gcc preprocessor < 7, it might be sufficient to call the gcc preprocessor in a way that it pretends to supports _Float128. I do not know if that is possible, but if it can be done via some argument parsed to the preprocessor, that would be a simple and pragmatic solution that does not even require a language-c change. If it is not possible to workaround the issue with preprocessor options, I would suggest the first option suggested by @jchia, and simply state that code that re-typedefs _Float128 is not supported. |
@visq I have been attempting to perform the fix suggested by @jchia:
My current approach is this diff in
I am going to play with this approach. Are there any gotchas I need to be worried about? The above patch does build with |
@krakrjak Good idea! You only want to #if _Float128, not __float128 though. If this works, let's merge it and publish a bugfix release. |
@krakrjak @visq This seems to be confusing the compiler that's installed at the time that language-c is built, with the compiler that's installed when language-c is running. Those are often the same, but they don't have to be. I don't really have a better suggestion, however. (In my own downstream project I can afford to do some preprocessor hacks to define |
@lambdageek you are so right... I'm really not sure how we would inject this detection purely at runtime... |
@lambdageek you are right, relying on build time gcc version is probably not ideal; if you update to gcc7 later, there is no simple way to specify that you need to update language-c, too. We could introduce a Cabal flag for _Float128; then it is up to the package manager or the user to decide whether _Float128 is needed. |
I guess one thing that I'm unclear about is why The next suggestion: can we make As a practical matter, we can:
|
@lambdageek No, it does not need its own lexer token. As I wrote before in this thread, adding it to builtin typedefs is a possible solution, but requires an API change to be runtime configurable. |
In glibc-2.27, there are now also I'm getting error messages that look like this:
This error is for code that looks like this:
|
_Float128
is not a type natively recognized by the compiler, so it's put in a typedef. This is consistent with what we can tell from the glibc-2.26 announcement at https://sourceware.org/ml/libc-announce/2017/msg00001.html._Float128
tolanguage-c
, solanguage-c
becomes like a compiler that natively recognizes_Float128
, i.e. GCC 7.0 and above, under which the abovetypedef
line would be rejected.language-c
deals with macros when parsing source files, specifically what macro definitions it starts with by default, but I wonder, to properly handle this case infloatn.h
, whetherlanguage-c
should define macros related to GCC version and pretend to be GCC 7?Currently, there is the following test case that breaks: Take the
BasicUsage.hs
example, but instead of 'test.c', compile a file with the following content:And:
newGCC
ORlanguage-c
.)An error is observed for the
typedef
line: "Syntax error ! The symbol ',' does not fit here."I'm not sure where
language-c
gets default macro definitons, but I suspect it just takes the macros from whatever gcc is used fornewGCC
.The text was updated successfully, but these errors were encountered: