List, I am working on having clang parse a recent windows.h header. I am encountering great success, however I have one problem with inlined functions. In winnt.h, there are a series of definitions for Int64ShllMod32 and related functions, these functions are defined as __inline. Compiling a multi file project with clang produces errors because these functions appear more than once and at link time collisions occur. The problem seems to stem from the functions not being defined as 'static'. If the functions are defined as static, they are inlined and removed during compilation. Without the static definition, the optimizer doesn't know it is safe to remove the functions after they have been inlined. It seems that MSVC silently promotes any function declared __inline or __forceinline to static (or something equivalent/similar). My thinking is adding in a "compatibility" layer to clang so that when dealing with windows header files clang also promotes any function defined as inline to static storage. What does the list think? Is this a good idea? If it is, where would a good place to start in clang be to implement it? If it isn't a good idea, what would be? Thank you, Andrew
Hi Andrew,> List,wrong list - this question should be asked on the clang mailing list, see http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev Ciao, Duncan.> > I am working on having clang parse a recent windows.h header. I am > encountering great success, however I have one problem with inlined > functions. In winnt.h, there are a series of definitions for > Int64ShllMod32 and related functions, these functions are defined as > __inline. Compiling a multi file project with clang produces errors > because these functions appear more than once and at link time > collisions occur. > > The problem seems to stem from the functions not being defined as > 'static'. If the functions are defined as static, they are inlined and > removed during compilation. Without the static definition, the > optimizer doesn't know it is safe to remove the functions after they > have been inlined. > > It seems that MSVC silently promotes any function declared __inline or > __forceinline to static (or something equivalent/similar). My thinking > is adding in a "compatibility" layer to clang so that when dealing > with windows header files clang also promotes any function defined as > inline to static storage. What does the list think? Is this a good > idea? If it is, where would a good place to start in clang be to > implement it? If it isn't a good idea, what would be? > > Thank you, > > Andrew > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reasonably Related Threads
- MSVC warning noise on "LLVM_ATTRIBUTE_ALWAYS_INLINE inline void foo()"
- MSVC warning noise on "LLVM_ATTRIBUTE_ALWAYS_INLINE inline void foo()"
- [PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations
- [PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations
- [PATCH v2 1/2] compiler-gcc.h: add gnu_inline to all inline declarations