Skip to content

Commit

Permalink
[getopt-win32] Rename "extern C" macros as MS VC C++ headers use _END…
Browse files Browse the repository at this point in the history
…_EXTERN_C macro (microsoft#22773)
  • Loading branch information
mkhon authored Jan 26, 2022
1 parent c76e5f0 commit c34b8fe
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
50 changes: 50 additions & 0 deletions ports/getopt-win32/getopt.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
commit 81c35ed14e07138e44b5b30f52fbc2bb26ae1fed
Author: Max Khon <[email protected]>
Date: Mon Jan 24 23:05:24 2022 +0700

Rename "extern C" macros as MS VC C++ headers use _END_EXTERN_C macro

diff --git a/getopt.h b/getopt.h
index 5ed4a46..5e33682 100644
--- a/getopt.h
+++ b/getopt.h
@@ -57,12 +57,12 @@ EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

// Change behavior for C\C++
#ifdef __cplusplus
- #define _BEGIN_EXTERN_C extern "C" {
- #define _END_EXTERN_C }
+ #define _GETOPT_BEGIN_EXTERN_C extern "C" {
+ #define _GETOPT_END_EXTERN_C }
#define _GETOPT_THROW throw()
#else
- #define _BEGIN_EXTERN_C
- #define _END_EXTERN_C
+ #define _GETOPT_BEGIN_EXTERN_C
+ #define _GETOPT_END_EXTERN_C
#define _GETOPT_THROW
#endif

@@ -81,7 +81,7 @@ EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#include <string.h>
#include <wchar.h>

-_BEGIN_EXTERN_C
+_GETOPT_BEGIN_EXTERN_C

extern _GETOPT_API int optind;
extern _GETOPT_API int opterr;
@@ -113,10 +113,10 @@ _BEGIN_EXTERN_C
extern _GETOPT_API int getopt_long_w(int argc, wchar_t *const *argv, const wchar_t *options, const struct option_w *long_options, int *opt_index) _GETOPT_THROW;
extern _GETOPT_API int getopt_long_only_w(int argc, wchar_t *const *argv, const wchar_t *options, const struct option_w *long_options, int *opt_index) _GETOPT_THROW;

-_END_EXTERN_C
+_GETOPT_END_EXTERN_C

- #undef _BEGIN_EXTERN_C
- #undef _END_EXTERN_C
+ #undef _GETOPT_BEGIN_EXTERN_C
+ #undef _GETOPT_END_EXTERN_C
#undef _GETOPT_THROW
#undef _GETOPT_API

1 change: 1 addition & 0 deletions ports/getopt-win32/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ vcpkg_from_github(
REF 0.1
SHA512 40e2a901241a5d751cec741e5de423c8f19b105572c7cae18adb6e69be0b408efc6c9a2ecaeb62f117745eac0d093f30d6b91d88c1a27e1f7be91f0e84fdf199
HEAD_REF master
PATCHES getopt.h.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
Expand Down
3 changes: 2 additions & 1 deletion ports/getopt-win32/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "getopt-win32",
"version-string": "0.1",
"port-version": 1,
"port-version": 2,
"description": "An implementation of getopt.",
"homepage": "https://github.com/libimobiledevice-win32",
"license": "LGPL-3.0-only",
"supports": "windows"
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@
},
"getopt-win32": {
"baseline": "0.1",
"port-version": 1
"port-version": 2
},
"gettext": {
"baseline": "0.21",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/getopt-win32.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "93d03f637c26f2efa154dfd7c3efb02074cf5eda",
"version-string": "0.1",
"port-version": 2
},
{
"git-tree": "d4b235f13a89dbec23f09caa05c7b71c176cfab8",
"version-string": "0.1",
Expand Down

0 comments on commit c34b8fe

Please sign in to comment.