diff --git a/CMakeLists.txt b/CMakeLists.txt index 1af1a7f4..ff73c123 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,9 +118,6 @@ elseif(WIN32) include_directories(${CMAKE_SOURCE_DIR}/win32_config) endif() -# Needed for C++ compat -add_definitions(-Drestrict=__restrict) - # i18n support checking include(FindGettext) include(FindIntl) diff --git a/libticonv/trunk/src/ticonv.h b/libticonv/trunk/src/ticonv.h index c5dbfa4d..d8e0e866 100644 --- a/libticonv/trunk/src/ticonv.h +++ b/libticonv/trunk/src/ticonv.h @@ -41,6 +41,13 @@ #ifdef __cplusplus extern "C" { +#endif + +// Work around a Windows SDK issue that prevents us from just using "restrict" directly in both C/C++. +#if defined(__cplusplus) || defined(_MSC_VER) +#define _ticonv_restrict_backup restrict +#undef restrict +#define restrict __restrict #endif /***********************/ @@ -213,6 +220,11 @@ typedef struct /* Deprecated functions */ /************************/ +#if defined(__cplusplus) || defined(_MSC_VER) +#undef restrict +#define restrict _ticonv_restrict_backup +#endif + #ifdef __cplusplus } #endif