JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
CompilerUtil.H
Go to the documentation of this file.
1// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2//
3// JeVois Smart Embedded Machine Vision Toolkit - Copyright (C) 2016 by Laurent Itti, the University of Southern
4// California (USC), and iLab at USC. See http://iLab.usc.edu and http://jevois.org for information about this project.
5//
6// This file is part of the JeVois Smart Embedded Machine Vision Toolkit. This program is free software; you can
7// redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software
8// Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
10// License for more details. You should have received a copy of the GNU General Public License along with this program;
11// if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
12//
13// Contact information: Laurent Itti - 3641 Watt Way, HNB-07A - Los Angeles, CA 90089-2520 - USA.
14// Tel: +1 213 740 3527 - itti@pollux.usc.edu - http://iLab.usc.edu - http://jevois.org
15// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
16
17#pragma once
18
19// This code from:
20
21/* author Shane Grant <wgrant@usc.edu>
22// ////////////////////////////////////////////////////////////////////////
23// The iLab Neuromorphic Robotics Toolkit (NRT) //
24// Copyright 2010-2012 by the University of Southern California (USC) //
25// and the iLab at USC. //
26// //
27// iLab - University of Southern California //
28// Hedco Neurociences Building, Room HNB-10 //
29// Los Angeles, Ca 90089-2520 - USA //
30// //
31// See http://ilab.usc.edu for information about this project. //
32// ////////////////////////////////////////////////////////////////////////
33// This file is part of The iLab Neuromorphic Robotics Toolkit. //
34// //
35// The iLab Neuromorphic Robotics Toolkit is free software: you can //
36// redistribute it and/or modify it under the terms of the GNU General //
37// Public License as published by the Free Software Foundation, either //
38// version 3 of the License, or (at your option) any later version. //
39// //
40// The iLab Neuromorphic Robotics Toolkit is distributed in the hope //
41// that it will be useful, but WITHOUT ANY WARRANTY; without even the //
42// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
43// PURPOSE. See the GNU General Public License for more details. //
44// //
45// You should have received a copy of the GNU General Public License //
46// along with The iLab Neuromorphic Robotics Toolkit. If not, see //
47// <http://www.gnu.org/licenses/>. //
48// ////////////////////////////////////////////////////////////////////////
49*/
50
51#include <boost/preprocessor/stringize.hpp>
52#include <boost/preprocessor/if.hpp>
53
54/*! \defgroup compilerutil Miscellaneous preprocessor utilities related to controlling compilation
55 \ingroup utils */
56
57// Get the compiler name: (see http://stackoverflow.com/questions/19204792/c-if-elif-endif-dont-seem-to-work for why we
58// use 2 variables; JEVOIS_COMPILER_NAME is used for macro expansion with the name, JEVOIS_COMPILER used for #if
59// testing):
60#define JEVOIS_COMPILER_GCC 1
61#define JEVOIS_COMPILER_CLANG 2
62#define JEVOIS_COMPILER_OTHER 3
63
64#if defined __clang__
65#define JEVOIS_COMPILER JEVOIS_COMPILER_CLANG
66#define JEVOIS_COMPILER_NAME clang
67#elif defined __GNUC__
68#define JEVOIS_COMPILER JEVOIS_COMPILER_GCC
69#define JEVOIS_COMPILER_NAME GCC
70#else
71#define JEVOIS_COMPILER JEVOIS_COMPILER_OTHER
72#define JEVOIS_COMPILER_NAME other
73#endif
74
75#define JEVOIS_PRAGMA(x) _Pragma(BOOST_PP_STRINGIZE(JEVOIS_COMPILER_NAME x))
76
77/*! @def JEVOIS_BEGIN_UNCHECKED_INCLUDES
78 A series of preprocessor directives that turns off specific warnings as
79 errors until the matching JEVOIS_END_UNCHECKED_INCLUDES. This is useful for
80 libraries that are written with code that won't compile under -Wall.
81
82 Must be followed by a matching JEVOIS_END_UNCHECKED_INCLUDES
83 @ingroup compilerutil */
84#define JEVOIS_BEGIN_UNCHECKED_INCLUDES JEVOIS_PRAGMA(diagnostic push) \
85 JEVOIS_PRAGMA(diagnostic ignored "-Wpragmas") \
86 JEVOIS_PRAGMA(diagnostic ignored "-Wunknown-pragmas") \
87 JEVOIS_PRAGMA(diagnostic ignored "-Wunused-local-typedefs") \
88 JEVOIS_PRAGMA(diagnostic ignored "-Wattributes") \
89 JEVOIS_PRAGMA(diagnostic ignored "-Wconstant-conversion") \
90 JEVOIS_PRAGMA(diagnostic ignored "-Wenum-compare") \
91 JEVOIS_PRAGMA(diagnostic ignored "-Wunknown-attributes") \
92 JEVOIS_PRAGMA(diagnostic ignored "-Wunused-but-set-variable") \
93 JEVOIS_PRAGMA(diagnostic ignored "-Wreorder") \
94 JEVOIS_PRAGMA(diagnostic ignored "-Wall")
95
96/*! @def JEVOIS_END_UNCHECKED_INCLUDES
97 Turns back on all warnings that were in effect prior to an JEVOIS_BEGIN_UNCHECKED_INCLUDES.
98 @ingroup compilerutil */
99#define JEVOIS_END_UNCHECKED_INCLUDES JEVOIS_PRAGMA(diagnostic pop)