Skip to content

Commit

Permalink
windows: get the build working further (restrict usage)
Browse files Browse the repository at this point in the history
Note: we cannot simply do a -Drestrict=__restrict
because of an internal conflict with the windows SDK
  • Loading branch information
adriweb authored and debrouxl committed Nov 26, 2023
1 parent 57733d5 commit 5ab36f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions libticonv/trunk/src/ticonv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/***********************/
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5ab36f3

Please sign in to comment.