Skip to content

Commit

Permalink
moved out strict mode macros in separate file, added back some of the…
Browse files Browse the repository at this point in the history
… missing changes after bad pull, added back pedantic, included better contribution guidelines
  • Loading branch information
sytelus committed Feb 18, 2017
1 parent ea48ff1 commit 847744c
Show file tree
Hide file tree
Showing 12 changed files with 355 additions and 325 deletions.
1 change: 1 addition & 0 deletions AirLib/AirLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<ClInclude Include="include\common\common_utils\RandomGenerator.hpp" />
<ClInclude Include="include\common\common_utils\ScheduledExecutor.hpp" />
<ClInclude Include="include\common\common_utils\sincos.hpp" />
<ClInclude Include="include\common\common_utils\StrictMode.hpp" />
<ClInclude Include="include\common\common_utils\type_utils.hpp" />
<ClInclude Include="include\common\common_utils\Utils.hpp" />
<ClInclude Include="include\common\DelayLine.hpp" />
Expand Down
3 changes: 3 additions & 0 deletions AirLib/AirLib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@
<ClInclude Include="include\control\Settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\common\common_utils\StrictMode.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\control\DroneControlBase.cpp">
Expand Down
44 changes: 44 additions & 0 deletions AirLib/include/common/common_utils/StrictMode.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef common_StrictMode_hpp
#define common_StrictMode_hpp

#if defined(_MSC_VER)
//'=': conversion from 'double' to 'float', possible loss of data
#define STRICT_MODE_OFF \
__pragma(warning(push)) \
__pragma(warning( disable : 4100 4189 4244 4245 4239 4464 4456 4505 4514 4571 4624 4626 4267 4710 4820 5027 5031))
#define STRICT_MODE_ON \
__pragma(warning(pop))

//TODO: limit scope of below statements required to suppress VC++ warnings
#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:4996)
#endif


#ifdef __GNUC__
#define STRICT_MODE_OFF \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
_Pragma("GCC diagnostic ignored \"-Wdelete-non-virtual-dtor\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("GCC diagnostic ignored \"-pedantic\"") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wredundant-decls\"")

/* Addition options that can be enabled
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
_Pragma("GCC diagnostic ignored \"-Wformat=\"") \
_Pragma("GCC diagnostic ignored \"-Werror\"") \
_Pragma("GCC diagnostic ignored \"-Werror=\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
*/

#define STRICT_MODE_ON \
_Pragma("GCC diagnostic pop")
#endif


#endif
44 changes: 2 additions & 42 deletions AirLib/include/common/common_utils/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,7 @@
#ifndef common_utils_Utils_hpp
#define common_utils_Utils_hpp

#if defined(_MSC_VER)
//TODO: limit scope of below statements required to suppress VC++ warnings
#define _CRT_SECURE_NO_WARNINGS 1
#pragma warning(disable:4996)
#endif

#ifdef __GNUC__
#define STRICT_MODE_OFF \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
_Pragma("GCC diagnostic ignored \"-Wdelete-non-virtual-dtor\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wredundant-decls\"")

/* Addition options that can be enabled
_Pragma("GCC diagnostic ignored \"-Wpedantic\"") \
_Pragma("GCC diagnostic ignored \"-Wformat=\"") \
_Pragma("GCC diagnostic ignored \"-Werror\"") \
_Pragma("GCC diagnostic ignored \"-Werror=\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
*/

#define STRICT_MODE_ON \
_Pragma("GCC diagnostic pop")
#else
#if defined(_MSC_VER)
//'=': conversion from 'double' to 'float', possible loss of data
#define STRICT_MODE_OFF \
__pragma(warning(push)) \
__pragma(warning( disable : 4100 4189 4244 4245 4239 4464 4456 4505 4514 4571 4624 4626 4267 4710 4820 5027 5031))
#define STRICT_MODE_ON \
__pragma(warning(pop))
#endif
#endif
#include "StrictMode.hpp"
#include <chrono>
#include <thread>
#include <memory>
Expand All @@ -58,12 +21,9 @@
#include <iostream>
#include <limits>
#include <queue>

#include "type_utils.hpp"

#ifndef _WIN32
#include <limits.h>
#include <sys/param.h>
#endif

//Stubs for C++17 optional type
#if (defined __cplusplus) && (__cplusplus >= 201700L)
Expand Down
16 changes: 8 additions & 8 deletions DroneShell/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,14 +932,14 @@ See RecordPose for information about log file format")
};


std::string beforeScriptStartCallback(const DroneCommandParameters& params, std::string scriptFilePath)
{
return false;
}
bool afterScriptEndCallback(const DroneCommandParameters& params, std::string scriptFilePath)
{
return false;
}
// std::string beforeScriptStartCallback(const DroneCommandParameters& params, std::string scriptFilePath)
// {
// return false;
// }
// bool afterScriptEndCallback(const DroneCommandParameters& params, std::string scriptFilePath)
// {
// return false;
// }
// std::string beforeScriptCommandStartCallback(const DroneCommandParameters& params) {
// params.context->client.newTask();
// }
Expand Down
2 changes: 1 addition & 1 deletion HelloDrone/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int main()
client.armDisarm(false);

}
catch (rpc::rpc_error e) {
catch (rpc::rpc_error& e) {
std::string msg = e.get_error().as<std::string>();
cout << "Exception raised by the API, something went wrong." << endl << msg << endl;
}
Expand Down
1 change: 1 addition & 0 deletions MavLinkCom/MavLinkCom.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
<ClCompile Include="src\serial_com\TcpServer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="common_utils\StrictMode.hpp" />
<ClInclude Include="include\AsyncResult.hpp" />
<ClInclude Include="common_utils\EnumFlags.hpp" />
<ClInclude Include="common_utils\ExceptionUtils.hpp" />
Expand Down
Loading

0 comments on commit 847744c

Please sign in to comment.