This is an archive of the discontinued LLVM Phabricator instance.

Fix broken HUGE_VALF macro in llvm-c/DataTypes.h
ClosedPublic

Authored by teemperor on Jul 14 2020, 4:35 AM.

Details

Summary

Commit 3a29393b4709d15069130119cf1d136af4a92d77 removes the cmath/math.h includes
from the DataTypes.h header to speed up parsing. However the DataTypes.h header was using
this header to get the macro HUGE_VAL for its own HUGE_VALF macro definition. Now
the macro instead just expands into a plain HUGE_VAL token which leads to compiler errors
unless math.h was previously included by the including source file. It also leads to compiler
warnings with enabled module builds which point out this inconsistency.

The correct way to fix this seems to be to just remove HUGE_VALF from the header. llvm-c
is not referencing that macro from what I can see and users probably should just include
the math headers if they need it (or define it on their own for really old C versions).

Diff Detail

Event Timeline

teemperor created this revision.Jul 14 2020, 4:35 AM
Herald added a project: Restricted Project. · View Herald Transcript

@rnk seems OOO but he did the original change, so I just added a bunch of other folks who could review this.

JDevlieghere accepted this revision.Jul 14 2020, 9:44 AM

Another alternative would be to check if HUGE_VAL is defined, but if I agree that if it's not used it should just go.

This revision is now accepted and ready to land.Jul 14 2020, 9:44 AM
This revision was landed with ongoing or failed builds.Sep 3 2020, 12:50 AM
This revision was automatically updated to reflect the committed changes.