fixed: osx106 warnings

This commit is contained in:
Nick Bolton 2014-02-26 15:53:28 +00:00
parent 228befdc2c
commit 8d6a44d1b7
12 changed files with 97 additions and 55 deletions

View File

@ -155,7 +155,4 @@ enum {
kExitConfig = 4 // cannot read configuration kExitConfig = 4 // cannot read configuration
}; };
// gnu 4.6+ has pragma diagnostic push and tautological-compare
#define GNUC_46 defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
#endif #endif

View File

@ -19,24 +19,7 @@
#include "ECryptoMode.h" #include "ECryptoMode.h"
#include "CString.h" #include "CString.h"
#include "CCryptoMode_cryptopp.h"
#if __APPLE__
# if GNUC_46
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtautological-compare"
# endif
# pragma GCC diagnostic ignored "-Wall"
#endif
#include <cryptopp562/gcm.h>
#include <cryptopp562/modes.h>
#include <cryptopp562/aes.h>
#if __APPLE__
# if GNUC_46
# pragma GCC diagnostic pop
# endif
#endif
//! Encapsulation of modes //! Encapsulation of modes
/*! /*!

View File

@ -0,0 +1,30 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Bolton Software Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// HACK: gcc on osx106 doesn't give you an easy way to hide warnings
// from included headers, so use the system_header pragma. the downside
// is that everything in the header file following this also has warnings
// ignored, so we need to put it in a separate header file.
#if __APPLE__
# pragma GCC system_header
#endif
#include <cryptopp562/gcm.h>
#include <cryptopp562/modes.h>
#include <cryptopp562/aes.h>

View File

@ -60,7 +60,7 @@ CCryptoStream::read(void* out, UInt32 n)
LOG((CLOG_DEBUG4 "crypto: read %i (decrypt)", n)); LOG((CLOG_DEBUG4 "crypto: read %i (decrypt)", n));
byte* cypher = new byte[n]; byte* cypher = new byte[n];
int result = getStream()->read(cypher, n); size_t result = getStream()->read(cypher, n);
if (result == 0) { if (result == 0) {
// nothing to read. // nothing to read.
return 0; return 0;

View File

@ -20,22 +20,7 @@
#include "BasicTypes.h" #include "BasicTypes.h"
#include "CStreamFilter.h" #include "CStreamFilter.h"
#include "CCryptoMode.h" #include "CCryptoMode.h"
#include "CCryptoStream_cryptopp.h"
#if __APPLE__
# if GNUC_46
# pragma GCC diagnostic push
# endif
# pragma GCC diagnostic ignored "-Wall"
#endif
#include <cryptopp562/osrng.h>
#include <cryptopp562/sha.h>
#if __APPLE__
# if GNUC_46
# pragma GCC diagnostic pop
# endif
#endif
class CCryptoOptions; class CCryptoOptions;

View File

@ -0,0 +1,29 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Bolton Software Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// HACK: gcc on osx106 doesn't give you an easy way to hide warnings
// from included headers, so use the system_header pragma. the downside
// is that everything in the header file following this also has warnings
// ignored, so we need to put it in a separate header file.
#if __APPLE__
# pragma GCC system_header
#endif
#include <cryptopp562/osrng.h>
#include <cryptopp562/sha.h>

View File

@ -2100,9 +2100,6 @@ COSXScreen::getDraggingFilename()
return m_draggingFilename; return m_draggingFilename;
} }
#if GNUC_46
# pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void void
@ -2143,6 +2140,4 @@ avoidHesitatingCursor()
CGSetLocalEventsSuppressionInterval(0.0001); CGSetLocalEventsSuppressionInterval(0.0001);
} }
#if GNUC_46 #pragma GCC diagnostic error "-Wdeprecated-declarations"
# pragma GCC diagnostic pop
#endif

View File

@ -161,9 +161,6 @@ COSXScreenSaver::launchTerminationCallback(
return (CallNextEventHandler(nextHandler, theEvent)); return (CallNextEventHandler(nextHandler, theEvent));
} }
#if GNUC_46
# pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void void
@ -199,6 +196,4 @@ testProcessName(const char* name, const ProcessSerialNumber& psn)
return (err == 0 && CFEqual(CFSTR("ScreenSaverEngine"), processName)); return (err == 0 && CFEqual(CFSTR("ScreenSaverEngine"), processName));
} }
#if GNUC_46 #pragma GCC diagnostic error "-Wdeprecated-declarations"
# pragma GCC diagnostic pop
#endif

View File

@ -28,7 +28,7 @@ CDragInformation::parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CSt
size_t findResult2 = 0; size_t findResult2 = 0;
dragFileList.clear(); dragFileList.clear();
CString slash("\\"); CString slash("\\");
if (data.find("/", startPos) != -1) { if (data.find("/", startPos) != string::npos) {
slash = "/"; slash = "/";
} }
@ -51,9 +51,9 @@ CDragInformation::parseDragInfo(CDragFileList& dragFileList, UInt32 fileNum, CSt
CString CString
CDragInformation::getDragFileExtension(CString fileName) CDragInformation::getDragFileExtension(CString fileName)
{ {
size_t findResult = -1; size_t findResult = string::npos;
findResult = fileName.find_last_of(".", fileName.size()); findResult = fileName.find_last_of(".", fileName.size());
if (findResult != -1) { if (findResult != string::npos) {
return fileName.substr(findResult + 1, fileName.size() - findResult - 1); return fileName.substr(findResult + 1, fileName.size() - findResult - 1);
} }
else { else {

28
src/test/gtest.h Normal file
View File

@ -0,0 +1,28 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2014 Bolton Software Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file COPYING that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// HACK: gcc on osx106 doesn't give you an easy way to hide warnings
// from included headers, so use the system_header pragma. the downside
// is that everything in the header file following this also has warnings
// ignored, so we need to put it in a separate header file.
#if __APPLE__
# pragma GCC system_header
#endif
#include <gtest/gtest.h>

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <gtest/gtest.h> #include <../../gtest.h>
#include "CClipboard.h" #include "CClipboard.h"
TEST(CClipboardTests, empty_openCalled_returnsTrue) TEST(CClipboardTests, empty_openCalled_returnsTrue)

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <gtest/gtest.h> #include <../../gtest.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include "CKeyStateTests.h" #include "CKeyStateTests.h"
#include "CMockEventQueue.h" #include "CMockEventQueue.h"