win: Compile getopt as C++ and wrap in crashpad namespace

All our Main()s are in namespace crashpad already, so this just works.

R=mark@chromium.org
BUG=crashpad:76

Review URL: https://codereview.chromium.org/1439113002 .
This commit is contained in:
Scott Graham 2015-11-12 14:10:24 -08:00
parent 6e89d45d7d
commit 7a7d66ca89
4 changed files with 26 additions and 21 deletions

View File

@ -12,3 +12,4 @@ Local Modifications:
- Minor compilation fixes applied for Windows.
- Add copy of copyright (Public domain) to the top of both files for Chromium's
checklicenses step.
- Compiled as .cc, and wrapped in namespace crashpad.

View File

@ -99,6 +99,8 @@ gpietsch@comcast.net
#include "getopt.h"
#endif
namespace crashpad {
/* macros */
/* types */
@ -415,4 +417,6 @@ getopt_long_only (int argc, char **argv, const char *shortopts,
return getopt_internal (argc, argv, (char*)shortopts, (GETOPT_LONG_OPTION_T*)longopts, longind, 1);
}
} // namespace crashpad
/* end of file GETOPT.C */

View File

@ -23,7 +23,7 @@
'target_name': 'getopt',
'type': 'static_library',
'sources': [
'getopt.c',
'getopt.cc',
'getopt.h',
],
},

View File

@ -18,6 +18,8 @@ using it.
/* types defined by this include file */
namespace crashpad {
/* GETOPT_LONG_OPTION_T: The type of long option */
typedef struct GETOPT_LONG_OPTION_T
{
@ -35,28 +37,26 @@ typedef struct GETOPT_LONG_OPTION_T
typedef GETOPT_LONG_OPTION_T option;
#ifdef __cplusplus
extern "C"
{
#endif
/* externally-defined variables */
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
/* externally-defined variables */
extern char *optarg;
extern int optind;
extern int opterr;
extern int optopt;
/* function prototypes */
int getopt(int argc, char** argv, char* optstring);
int getopt_long(int argc,
char** argv,
const char* shortopts,
const GETOPT_LONG_OPTION_T* longopts,
int* longind);
int getopt_long_only(int argc,
char** argv,
const char* shortopts,
const GETOPT_LONG_OPTION_T* longopts,
int* longind);
/* function prototypes */
int getopt (int argc, char **argv, char *optstring);
int getopt_long (int argc, char **argv, const char *shortopts,
const GETOPT_LONG_OPTION_T * longopts, int *longind);
int getopt_long_only (int argc, char **argv, const char *shortopts,
const GETOPT_LONG_OPTION_T * longopts, int *longind);
#ifdef __cplusplus
};
#endif
} // namespace crashpad
#endif /* GETOPT_H */