Fixing/disabling Windows x64 warnings

Disabled MSVC #4267 warnings in common.gypi to enable x64 builds
for Windows.
Fixed MSVC #4267 warnings in test/testsupport.
Added third_party/directxsdk to .gitignore.

With http://review.webrtc.org/1070008 landed, this should make it possible
to build for x64 on Windows.

BUG=1348
TEST=Compiling with http://review.webrtc.org/1070008 applied:
set GYP_DEFINES="target_arch=x64"
set GYP_GENERATORS=ninja
gclient sync
ninja -C out\Debug_x64

Review URL: https://webrtc-codereview.appspot.com/1060008

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3464 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org
2013-02-04 10:07:17 +00:00
parent 254d85af54
commit fa53d8717c
26 changed files with 122 additions and 30 deletions

1
.gitignore vendored
View File

@@ -42,6 +42,7 @@
/testing /testing
/third_party/asan /third_party/asan
/third_party/cygwin /third_party/cygwin
/third_party/directxsdk
/third_party/expat /third_party/expat
/third_party/gaeunit /third_party/gaeunit
/third_party/gold /third_party/gold

View File

@@ -221,12 +221,12 @@
'WEBRTC_WIN', 'WEBRTC_WIN',
], ],
# TODO(andrew): enable all warnings when possible. # TODO(andrew): enable all warnings when possible.
# 4389: Signed/unsigned mismatch. # TODO(phoglund): get rid of 4373 supression when
# 4373: MSVC legacy warning for ignoring const / volatile in
# signatures. TODO(phoglund): get rid of 4373 supression when
# http://code.google.com/p/webrtc/issues/detail?id=261 is solved. # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
'msvs_disabled_warnings': [4389, 4373], 'msvs_disabled_warnings': [
4373, # legacy warning for ignoring const / volatile in signatures.
4389, # Signed/unsigned mismatch.
],
# Re-enable some warnings that Chromium disables. # Re-enable some warnings that Chromium disables.
'msvs_disabled_warnings!': [4189,], 'msvs_disabled_warnings!': [4189,],
}], }],

View File

@@ -89,6 +89,10 @@
'libyuv/scaler_unittest.cc', 'libyuv/scaler_unittest.cc',
'plane_unittest.cc', 'plane_unittest.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -23,6 +23,10 @@
'sources': [ 'sources': [
'./fix/test/kenny.cc', './fix/test/kenny.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], ],
} }

View File

@@ -211,6 +211,10 @@
'../../neteq4/mock/mock_packet_buffer.h', '../../neteq4/mock/mock_packet_buffer.h',
'../../neteq4/mock/mock_payload_splitter.h', '../../neteq4/mock/mock_payload_splitter.h',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # audio_coding_unittests }, # audio_coding_unittests
], ],
}], }],

View File

@@ -99,6 +99,10 @@
'sources': [ 'sources': [
'webrtc_neteq_unittest.cc', 'webrtc_neteq_unittest.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # neteq_unittests }, # neteq_unittests
{ {
'target_name': 'NetEqRTPplay', 'target_name': 'NetEqRTPplay',
@@ -137,6 +141,10 @@
'sources': [ 'sources': [
'test/NetEqRTPplay.cc', 'test/NetEqRTPplay.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
{ {
@@ -193,6 +201,10 @@
'test/NETEQTEST_RTPpacket.cc', 'test/NETEQTEST_RTPpacket.cc',
'test/NETEQTEST_RTPpacket.h', 'test/NETEQTEST_RTPpacket.h',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -113,6 +113,10 @@
'time_stretch.cc', 'time_stretch.cc',
'time_stretch.h', 'time_stretch.h',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
'conditions': [ 'conditions': [
@@ -144,7 +148,11 @@
'audio_decoder.cc', 'audio_decoder.cc',
'interface/audio_decoder.h', 'interface/audio_decoder.h',
], ],
}, # audio_decoder_unittest # Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # audio_decoder_unittests
{ {
'target_name': 'neteq_unittest_tools', 'target_name': 'neteq_unittest_tools',
@@ -168,6 +176,10 @@
'tools/rtp_generator.cc', 'tools/rtp_generator.cc',
'tools/rtp_generator.h', 'tools/rtp_generator.h',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # neteq_unittest_tools }, # neteq_unittest_tools
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -60,6 +60,10 @@
'sources': [ 'sources': [
'test/RTPencode.cc', 'test/RTPencode.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
{ {
@@ -168,6 +172,10 @@
'test/NETEQTEST_RTPpacket.cc', 'test/NETEQTEST_RTPpacket.cc',
'test/NETEQTEST_RTPpacket.h', 'test/NETEQTEST_RTPpacket.h',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
} }

View File

@@ -45,6 +45,10 @@
'rtcp_receiver_unittest.cc', 'rtcp_receiver_unittest.cc',
'vp8_partition_aggregator_unittest.cc', 'vp8_partition_aggregator_unittest.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], ],
} }

View File

@@ -97,6 +97,10 @@
'udp_socket_manager_unittest.cc', 'udp_socket_manager_unittest.cc',
'udp_socket_wrapper_unittest.cc', 'udp_socket_wrapper_unittest.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # udp_transport_unittests }, # udp_transport_unittests
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -19,10 +19,14 @@
'<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags', '<(DEPTH)/third_party/google-gflags/google-gflags.gyp:google-gflags',
'<(webrtc_root)/test/metrics.gyp:metrics', '<(webrtc_root)/test/metrics.gyp:metrics',
'<(webrtc_vp8_dir)/vp8.gyp:webrtc_vp8', '<(webrtc_vp8_dir)/vp8.gyp:webrtc_vp8',
], ],
'sources': [ 'sources': [
'video_quality_measurement.cc', 'video_quality_measurement.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -73,6 +73,10 @@
'include/vp8_common_types.h', 'include/vp8_common_types.h',
'vp8_impl.cc', 'vp8_impl.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
'conditions': [ 'conditions': [

View File

@@ -93,6 +93,10 @@
'../../codecs/test/stats_unittest.cc', '../../codecs/test/stats_unittest.cc',
'../../codecs/test/videoprocessor_unittest.cc', '../../codecs/test/videoprocessor_unittest.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], ],
} }

View File

@@ -187,8 +187,11 @@
], ],
}], }],
], ],
# Ignore warning on shift operator promotion. # Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [ 4334, ], 'msvs_disabled_warnings': [
4267, # size_t to int truncation.
4334, # Ignore warning on shift operator promotion.
],
}, },
], # targets ], # targets
'conditions': [ 'conditions': [
@@ -270,6 +273,10 @@
'sources!': [ 'thread_posix_unittest.cc', ], 'sources!': [ 'thread_posix_unittest.cc', ],
}], }],
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -30,7 +30,7 @@ FrameReaderImpl::~FrameReaderImpl() {
bool FrameReaderImpl::Init() { bool FrameReaderImpl::Init() {
if (frame_length_in_bytes_ <= 0) { if (frame_length_in_bytes_ <= 0) {
fprintf(stderr, "Frame length must be >0, was %d\n", fprintf(stderr, "Frame length must be >0, was %zu\n",
frame_length_in_bytes_); frame_length_in_bytes_);
return false; return false;
} }
@@ -46,7 +46,8 @@ bool FrameReaderImpl::Init() {
fprintf(stderr, "Found empty file: %s\n", input_filename_.c_str()); fprintf(stderr, "Found empty file: %s\n", input_filename_.c_str());
return false; return false;
} }
number_of_frames_ = source_file_size / frame_length_in_bytes_; number_of_frames_ = static_cast<int>(source_file_size /
frame_length_in_bytes_);
return true; return true;
} }

View File

@@ -40,7 +40,7 @@ class FrameReader {
virtual void Close() = 0; virtual void Close() = 0;
// Frame length in bytes of a single frame image. // Frame length in bytes of a single frame image.
virtual int FrameLength() = 0; virtual size_t FrameLength() = 0;
// Total number of frames in the input video source. // Total number of frames in the input video source.
virtual int NumberOfFrames() = 0; virtual int NumberOfFrames() = 0;
}; };
@@ -57,12 +57,12 @@ class FrameReaderImpl : public FrameReader {
bool Init(); bool Init();
bool ReadFrame(WebRtc_UWord8* source_buffer); bool ReadFrame(WebRtc_UWord8* source_buffer);
void Close(); void Close();
int FrameLength() { return frame_length_in_bytes_; } size_t FrameLength() { return frame_length_in_bytes_; }
int NumberOfFrames() { return number_of_frames_; } int NumberOfFrames() { return number_of_frames_; }
private: private:
std::string input_filename_; std::string input_filename_;
int frame_length_in_bytes_; size_t frame_length_in_bytes_;
int number_of_frames_; int number_of_frames_;
FILE* input_file_; FILE* input_file_;
}; };

View File

@@ -20,7 +20,7 @@ const std::string kInputFilename = "temp_inputfile.tmp";
const std::string kInputFileContents = "baz"; const std::string kInputFileContents = "baz";
// Setting the kFrameLength value to a value much larger than the // Setting the kFrameLength value to a value much larger than the
// file to test causes the ReadFrame test to fail on Windows. // file to test causes the ReadFrame test to fail on Windows.
const int kFrameLength = 1000; const size_t kFrameLength = 1000;
class FrameReaderTest: public testing::Test { class FrameReaderTest: public testing::Test {
protected: protected:

View File

@@ -28,7 +28,7 @@ FrameWriterImpl::~FrameWriterImpl() {
bool FrameWriterImpl::Init() { bool FrameWriterImpl::Init() {
if (frame_length_in_bytes_ <= 0) { if (frame_length_in_bytes_ <= 0) {
fprintf(stderr, "Frame length must be >0, was %d\n", fprintf(stderr, "Frame length must be >0, was %zu\n",
frame_length_in_bytes_); frame_length_in_bytes_);
return false; return false;
} }
@@ -54,10 +54,10 @@ bool FrameWriterImpl::WriteFrame(WebRtc_UWord8* frame_buffer) {
fprintf(stderr, "FrameWriter is not initialized (output file is NULL)\n"); fprintf(stderr, "FrameWriter is not initialized (output file is NULL)\n");
return false; return false;
} }
int bytes_written = fwrite(frame_buffer, 1, frame_length_in_bytes_, size_t bytes_written = fwrite(frame_buffer, 1, frame_length_in_bytes_,
output_file_); output_file_);
if (bytes_written != frame_length_in_bytes_) { if (bytes_written != frame_length_in_bytes_) {
fprintf(stderr, "Failed to write %d bytes to file %s\n", fprintf(stderr, "Failed to write %zu bytes to file %s\n",
frame_length_in_bytes_, output_filename_.c_str()); frame_length_in_bytes_, output_filename_.c_str());
return false; return false;
} }

View File

@@ -38,7 +38,7 @@ class FrameWriter {
virtual void Close() = 0; virtual void Close() = 0;
// Frame length in bytes of a single frame image. // Frame length in bytes of a single frame image.
virtual int FrameLength() = 0; virtual size_t FrameLength() = 0;
}; };
class FrameWriterImpl : public FrameWriter { class FrameWriterImpl : public FrameWriter {
@@ -55,11 +55,11 @@ class FrameWriterImpl : public FrameWriter {
bool Init(); bool Init();
bool WriteFrame(WebRtc_UWord8* frame_buffer); bool WriteFrame(WebRtc_UWord8* frame_buffer);
void Close(); void Close();
int FrameLength() { return frame_length_in_bytes_; } size_t FrameLength() { return frame_length_in_bytes_; }
private: private:
std::string output_filename_; std::string output_filename_;
int frame_length_in_bytes_; size_t frame_length_in_bytes_;
FILE* output_file_; FILE* output_file_;
}; };

View File

@@ -17,7 +17,7 @@ namespace webrtc {
namespace test { namespace test {
const std::string kOutputFilename = "temp_outputfile.tmp"; const std::string kOutputFilename = "temp_outputfile.tmp";
const int kFrameLength = 1000; const size_t kFrameLength = 1000;
class FrameWriterTest: public testing::Test { class FrameWriterTest: public testing::Test {
protected: protected:
@@ -50,8 +50,7 @@ TEST_F(FrameWriterTest, WriteFrame) {
ASSERT_TRUE(result); // success ASSERT_TRUE(result); // success
// Close the file and verify the size. // Close the file and verify the size.
frame_writer_->Close(); frame_writer_->Close();
ASSERT_EQ(kFrameLength, ASSERT_EQ(kFrameLength, GetFileSize(kOutputFilename));
static_cast<int>(GetFileSize(kOutputFilename)));
} }
TEST_F(FrameWriterTest, WriteFrameUninitialized) { TEST_F(FrameWriterTest, WriteFrameUninitialized) {

View File

@@ -23,7 +23,7 @@ class MockFrameReader : public FrameReader {
MOCK_METHOD0(Init, bool()); MOCK_METHOD0(Init, bool());
MOCK_METHOD1(ReadFrame, bool(WebRtc_UWord8* source_buffer)); MOCK_METHOD1(ReadFrame, bool(WebRtc_UWord8* source_buffer));
MOCK_METHOD0(Close, void()); MOCK_METHOD0(Close, void());
MOCK_METHOD0(FrameLength, int()); MOCK_METHOD0(FrameLength, size_t());
MOCK_METHOD0(NumberOfFrames, int()); MOCK_METHOD0(NumberOfFrames, int());
}; };

View File

@@ -23,7 +23,7 @@ class MockFrameWriter : public FrameWriter {
MOCK_METHOD0(Init, bool()); MOCK_METHOD0(Init, bool());
MOCK_METHOD1(WriteFrame, bool(WebRtc_UWord8* frame_buffer)); MOCK_METHOD1(WriteFrame, bool(WebRtc_UWord8* frame_buffer));
MOCK_METHOD0(Close, void()); MOCK_METHOD0(Close, void());
MOCK_METHOD0(FrameLength, int()); MOCK_METHOD0(FrameLength, size_t());
}; };
} // namespace test } // namespace test

View File

@@ -86,6 +86,10 @@
'frame_editing/frame_editing_lib.cc', 'frame_editing/frame_editing_lib.cc',
'frame_editing/frame_editing_lib.h', 'frame_editing/frame_editing_lib.h',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # frame_editing_lib }, # frame_editing_lib
{ {
'target_name': 'frame_editor', 'target_name': 'frame_editor',
@@ -115,6 +119,10 @@
'simple_command_line_parser_unittest.cc', 'simple_command_line_parser_unittest.cc',
'frame_editing/frame_editing_unittest.cc', 'frame_editing/frame_editing_unittest.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, # tools_unittests }, # tools_unittests
], # targets ], # targets
}], # include_tests }], # include_tests

View File

@@ -130,6 +130,10 @@
}, },
}], }],
], # conditions ], # conditions
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], ],
} }

View File

@@ -51,6 +51,10 @@
'testbed/tb_interfaces.cc', 'testbed/tb_interfaces.cc',
'testbed/tb_video_channel.cc', 'testbed/tb_video_channel.cc',
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
], ],
'conditions': [ 'conditions': [

View File

@@ -88,6 +88,10 @@
], ],
}], }],
], ],
# Disable warnings to enable Win64 build, issue 1323.
'msvs_disabled_warnings': [
4267, # size_t to int truncation.
],
}, },
{ {
# command line test that should work on linux/mac/win # command line test that should work on linux/mac/win