jlaurens / synctex

Synchronization for TeX
MIT License
57 stars 19 forks source link

Fix compilation on MSVC (fixes #58) #59

Closed stloeffler closed 1 year ago

stloeffler commented 1 year ago

which does not understand attribute((format(...)))

stloeffler commented 1 year ago

They are. I defined a new macro ATTRIBUTE_FORMAT_PRINTF (in synctex_parser_utils.h) which is empty (a no-op) if _MSC_VER is defined, and otherwise evaluates to the __attribute__ code (which works on both gcc and clang). This way, one doesn't litter the code with MSVC-specific #ifdef statements and retains the possibility to easily adapt (e.g., if MSVC gets a similar ability in the future; or if other compilers need special handling)

jlaurens commented 1 year ago

I prefixed the macro with SYNCTEX_ to let people (from the GCC/CLANG world) know that this is not an official macro, hope I did not make any mistake.