[cfe-dev] pragma float_control(push) or (pop)

Smith, Kevin B via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 16 15:36:48 PDT 2021


I was a little surprised by this behavior.  I was trying to write a header file that would use file scope pragma float_control(push) and pragma float_control(pop) and ran into this error.  It seems like this makes these pragmas pretty difficult to be effectively used.

Thank you,
Kevin Smith

$ clang bad.cpp
bad.cpp:2:9: error: '#pragma float_control push/pop' can only appear at file scope or namespace scope
#pragma float_control(push)
        ^
bad.cpp:9:9: error: '#pragma float_control push/pop' can only appear at file scope or namespace scope
#pragma float_control(pop)
        ^
2 errors generated.

$ cat bad.cpp
extern "C++" {
#pragma float_control(push)
#pragma clang fp reassociate(off)

  float my_silly_func(float a, float b) {
    return (a + b) - b;
  }

#pragma float_control(pop)
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210716/1d53ea0a/attachment-0001.html>


More information about the cfe-dev mailing list