File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -382,6 +382,13 @@ std::string SourceToHeaderMatchCallback::decorate(std::string_view name) const {
382382 return forStubHeader ? std::string (name) : NameDecorator::decorate (name);
383383}
384384
385+ const std::string GNUPREREQ = " !__GNUC_PREREQ (7, 0) || defined __cplusplus" ;
386+ const std::set<std::string> TypedefEscapeMap = {
387+ " _Float32" ,
388+ " _Float64" ,
389+ " _Float32x" ,
390+ " _Float64x"
391+ };
385392
386393void SourceToHeaderMatchCallback::print (const NamedDecl *decl, const PrintingPolicy &policy) const {
387394 if (externalStream == nullptr ) {
@@ -394,8 +401,20 @@ void SourceToHeaderMatchCallback::print(const NamedDecl *decl, const PrintingPol
394401 }
395402 auto name = decl->getNameAsString ();
396403 auto decoratedName = decorate (name);
404+ const auto it = TypedefEscapeMap.find (name);
397405 auto declaration = getRenamedDeclarationAsString (decl, policy, decoratedName);
398- *externalStream << declaration << " ;\n " ;
406+ if (it != TypedefEscapeMap.end ()) {
407+ *externalStream << " #ifdef __GNUC__\n "
408+ << " # include <features.h>\n "
409+ << " # if " << GNUPREREQ << " \n "
410+ << declaration << " ;\n "
411+ << " # endif" << " \n "
412+ << " #else" << " \n "
413+ << declaration << " ;\n "
414+ << " #endif" << " \n " ;
415+ } else {
416+ *externalStream << declaration << " ;\n " ;
417+ }
399418 if (pAlignmentAttr) {
400419 *externalStream << " #pragma pack(pop)\n " ;
401420 }
You can’t perform that action at this time.
0 commit comments