Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
Expand Down Expand Up @@ -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

Expand Down