Skip to content

Commit

Permalink
Issue #146 - First version of compiler detection macros
Browse files Browse the repository at this point in the history
  • Loading branch information
edouarda committed May 8, 2016
1 parent dfe4624 commit de53b1f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -48,6 +48,7 @@ set(BRIGAND_GROUP
brigand/adapted.hpp
brigand/algorithms.hpp
brigand/brigand.hpp
brigand/config.hpp
brigand/functions.hpp
brigand/sequences.hpp
brigand/types.hpp
Expand Down Expand Up @@ -228,6 +229,7 @@ set(test_files
test/bind.cpp
test/bitwise_test.cpp
test/comparison_test.cpp
test/config_test.cpp
test/eval_if_test.cpp
test/erase_c_test.cpp
test/find.cpp
Expand Down
21 changes: 21 additions & 0 deletions brigand/config.hpp
@@ -0,0 +1,21 @@
/*==================================================================================================
Copyright (c) 2015 Edouard Alligand and Joel Falcou
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
=================================================================================================**/
#pragma once

// configuration macros for brigand

#ifdef _MSC_VER
#define BRIGAND_COMP_MSVC
#endif

#ifdef __GNUC__
#ifndef __clang__
#define BRIGAND_COMP_GCC
#else
#define BRIGAND_COMP_CLANG
#endif
#endif
14 changes: 14 additions & 0 deletions test/config_test.cpp
@@ -0,0 +1,14 @@

#include <brigand/config.hpp>

#ifdef BRIGAND_COMP_MSVC
static_assert(_MSC_VER > 0, "wrong compiler detection macro");
#endif

#ifdef BRIGAND_COMP_GCC
static_assert(__GNUC__ > 0, "wrong compiler detection macro");
#endif

#ifdef BRIGAND_COMP_CLANG
static_assert(__clang__ > 0, "wrong compiler detection macro");
#endif

0 comments on commit de53b1f

Please sign in to comment.