Skip to content

Commit

Permalink
remove MSC_VER from starboard (#4129)
Browse files Browse the repository at this point in the history
b/362374622
  • Loading branch information
madhurajayaraman authored Sep 27, 2024
1 parent 96291cc commit 46be200
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 41 deletions.
5 changes: 2 additions & 3 deletions starboard/common/optional.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ class optional {
// Overloaded conversion to bool operator for determining whether the optional
// is engaged or not. It returns true if the optional is engaged, and false
// otherwise.
#if (defined(_MSC_VER) && (_MSC_VER < 1800)) || \
(defined(__GNUC__) && \
#if (defined(__GNUC__) && \
(__GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 5))))
// MSVC 2012 does not support explicit cast operators.
// http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx
Expand All @@ -199,7 +198,7 @@ class optional {
// == and != are already overloaded for optional, this leaves null tests,
// which we use for boolean testing.
class PrivateSafeBoolIdiomFakeMemberType;
typedef PrivateSafeBoolIdiomFakeMemberType optional::*SafeBoolIdiomType;
typedef PrivateSafeBoolIdiomFakeMemberType optional::* SafeBoolIdiomType;

public:
operator const SafeBoolIdiomType() const {
Expand Down
2 changes: 0 additions & 2 deletions starboard/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@

#if defined(__GNUC__)
#define SB_IS_COMPILER_GCC 1
#elif defined(_MSC_VER)
#define SB_IS_COMPILER_MSVC 1
#endif

// --- Common Helper Macros --------------------------------------------------
Expand Down
9 changes: 0 additions & 9 deletions starboard/elf_loader/exported_symbols.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,16 +387,7 @@ ExportedSymbols::ExportedSymbols() {
map_["getifaddrs"] = reinterpret_cast<const void*>(&__abi_wrap_getifaddrs);
map_["setsockopt"] = reinterpret_cast<const void*>(&__abi_wrap_setsockopt);

#if defined(_MSC_VER)
// MSVC provides a template with the same name.
// The cast helps the compiler to pick the correct C function pointer to be
// used.
REGISTER_SYMBOL(
static_cast<int (*)(wchar_t* buffer, size_t count, const wchar_t* format,
va_list argptr)>(vswprintf));
#else
REGISTER_SYMBOL(vswprintf);
#endif // defined(_MSC_VER)

} // NOLINT

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,13 @@ int stat_helper(int retval,

musl_info->st_size = stat_info->st_size;
musl_info->st_mode = stat_info->st_mode;
#if defined(_MSC_VER)
musl_info->st_atim.tv_sec = stat_info->st_atime;
musl_info->st_atim.tv_nsec = 0;
musl_info->st_mtim.tv_sec = stat_info->st_mtime;
musl_info->st_mtim.tv_nsec = 0;
musl_info->st_ctim.tv_sec = stat_info->st_ctime;
musl_info->st_ctim.tv_nsec = 0;
#else
musl_info->st_atim.tv_sec = stat_info->st_atim.tv_sec;
musl_info->st_atim.tv_nsec = stat_info->st_atim.tv_nsec;
musl_info->st_mtim.tv_sec = stat_info->st_mtim.tv_sec;
musl_info->st_mtim.tv_nsec = stat_info->st_mtim.tv_nsec;
musl_info->st_ctim.tv_sec = stat_info->st_ctim.tv_sec;
musl_info->st_ctim.tv_nsec = stat_info->st_ctim.tv_nsec;
#endif

return retval;
}

Expand Down
2 changes: 0 additions & 2 deletions starboard/shared/testing/no_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#define STARBOARD_SHARED_TESTING_NO_INLINE_H_
#if defined(__GNUC__)
#define SB_TEST_FORCE_NO_INLINE __attribute__((noinline))
#elif defined(_MSC_VER)
#define SB_TEST_FORCE_NO_INLINE __declspec(noinline)
#else
#error "Your compiler is not supported"
#endif
Expand Down
23 changes: 7 additions & 16 deletions starboard/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@

// The C library used must provide these headers to be standard conforming.

#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <float.h> // NOLINT
#include <inttypes.h> // NOLINT
#include <limits.h> // NOLINT
#include <stdarg.h> // NOLINT
#include <stdbool.h> // NOLINT
#include <stddef.h> // NOLINT
#include <stdint.h> // NOLINT

#if SB_HAS(SYS_TYPES_H)
#include <sys/types.h>
Expand All @@ -55,11 +55,6 @@ typedef int64_t ssize_t;
#endif
#endif // !SB_HAS(SSIZE_T)

#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable : 4310) // Cast truncates constant value.
#endif

// Simulate needed portions of limits.h for platforms that don't provide it.

static const int8_t kSbInt8Min = ((int8_t)0x80);
Expand All @@ -78,10 +73,6 @@ static const int64_t kSbInt64Min = ((int64_t)SB_INT64_C(0x8000000000000000));
static const int64_t kSbInt64Max = ((int64_t)SB_INT64_C(0x7FFFFFFFFFFFFFFF));
static const uint64_t kSbUInt64Max = ((uint64_t)SB_INT64_C(0xFFFFFFFFFFFFFFFF));

#if defined(_MSC_VER)
#pragma warning(pop)
#endif

// A value that represents an int that is probably invalid.
#define kSbInvalidInt kSbInt32Min

Expand Down

0 comments on commit 46be200

Please sign in to comment.