Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
ed2c9476
Commit
ed2c9476
authored
8 years ago
by
Joseph Noir
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #4643 from gebart/pr/clang-warning-fixes
Clang: Add support for C++
parents
15bda623
eff01f21
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.base
+1
-1
1 addition, 1 deletion
Makefile.base
cpu/Makefile.include.llvm
+66
-0
66 additions, 0 deletions
cpu/Makefile.include.llvm
sys/cpp11-compat/include/riot/mutex.hpp
+1
-1
1 addition, 1 deletion
sys/cpp11-compat/include/riot/mutex.hpp
with
68 additions
and
2 deletions
Makefile.base
+
1
−
1
View file @
ed2c9476
...
@@ -66,7 +66,7 @@ $(OBJCXX): $(BINDIR)$(MODULE)/%.o: %.cpp
...
@@ -66,7 +66,7 @@ $(OBJCXX): $(BINDIR)$(MODULE)/%.o: %.cpp
$(
AD
)$(
CCACHE
)
$(
CXX
)
\
$(
AD
)$(
CCACHE
)
$(
CXX
)
\
-DRIOT_FILE_RELATIVE
=
\"
$(
patsubst
$(
RIOTBASE
)
/%,%,
$(
abspath
$<
))
\"
\
-DRIOT_FILE_RELATIVE
=
\"
$(
patsubst
$(
RIOTBASE
)
/%,%,
$(
abspath
$<
))
\"
\
-DRIOT_FILE_NOPATH
=
\"
$(
notdir
$<
)
\"
\
-DRIOT_FILE_NOPATH
=
\"
$(
notdir
$<
)
\"
\
$(
CXXFLAGS
)
$(
INCLUDES
)
-MD
-MP
-c
-o
$@
$(
abspath
$<
)
$(
CXXFLAGS
)
$(
INCLUDES
)
$(
CXXINCLUDES
)
-MD
-MP
-c
-o
$@
$(
abspath
$<
)
$(ASMOBJ)
:
$(BINDIR)$(MODULE)/%.o: %.s
$(ASMOBJ)
:
$(BINDIR)$(MODULE)/%.o: %.s
$(
AD
)$(
AS
)
$(
ASFLAGS
)
-o
$@
$(
abspath
$<
)
$(
AD
)$(
AS
)
$(
ASFLAGS
)
-o
$@
$(
abspath
$<
)
...
...
This diff is collapsed.
Click to expand it.
cpu/Makefile.include.llvm
+
66
−
0
View file @
ed2c9476
export
GDBPREFIX
?=
$(
PREFIX
)
export
GDBPREFIX
?=
$(
PREFIX
)
export
LLVMPREFIX
?=
llvm-
export
LLVMPREFIX
?=
llvm-
# Apple XCode doesn't prefix its tools with llvm-, but manually installed LLVM
# on OSX might have the llvm- prefix, we can't simply test against uname -s.
# Test if llvm-ar exists
ifeq
(,$(shell command -v $(LLVMPREFIX)ar 2>/dev/null))
# fall back to system tools
export
LLVMPREFIX
:=
endif
export
CC
=
clang
export
CC
=
clang
export
CXX
=
clang++
export
CXX
=
clang++
export
LINK
=
$(
CC
)
export
LINK
=
$(
CC
)
...
@@ -17,7 +24,66 @@ export DBG = $(GDBPREFIX)gdb
...
@@ -17,7 +24,66 @@ export DBG = $(GDBPREFIX)gdb
# LLVM lacks a binutils strip tool as well...
# LLVM lacks a binutils strip tool as well...
#export STRIP = $(LLVMPREFIX)strip
#export STRIP = $(LLVMPREFIX)strip
# Clang on Linux uses GCC's C++ headers and libstdc++ (installed with GCC)
# Ubuntu and Debian use /etc/alternatives/gcc-$(TARGET_ARCH)-include/c++/$(GCC_VERSION)
# Arch uses /usr/$(TARGET_ARCH)/include/c++/$(GCC_VERSION)
# Gentoo uses /usr/lib/gcc/$(TARGET_ARCH)/$(GCC_VERSION)/include/g++-v5
GCC_CXX_INCLUDE_PATTERNS
?=
\
/etc/alternatives/gcc-
$(
TARGET_ARCH
)
-include
/c++/
*
/
\
/usr/
$(
TARGET_ARCH
)
/include/c++/
*
/
\
/usr/lib/gcc/
$(
TARGET_ARCH
)
/
*
/include/g++-v5
\
#
# Try to find the proper multilib directory using GCC, this may fail if a cross-
# GCC is not installed.
ifeq
($(GCC_MULTI_DIR),)
GCC_MULTI_DIR
:=
$(
shell
$(
PREFIX
)
gcc
-print-multi-directory
$(
CFLAGS
)
2>/dev/null
)
endif
# Tell clang to cross compile
# Tell clang to cross compile
export
CFLAGS
+=
-target
$(
TARGET_ARCH
)
export
CFLAGS
+=
-target
$(
TARGET_ARCH
)
export
CXXFLAGS
+=
-target
$(
TARGET_ARCH
)
export
CXXFLAGS
+=
-target
$(
TARGET_ARCH
)
export
LINKFLAGS
+=
-target
$(
TARGET_ARCH
)
export
LINKFLAGS
+=
-target
$(
TARGET_ARCH
)
# Use the wildcard Makefile function to search for existing directories matching
# the patterns above. We use the -isystem gcc/clang argument to add the include
# directories as system include directories, which means they will not be
# searched until after all the project specific include directories (-I/path)
# We sort the list of found directories and take the last one, it will likely be
# the most recent GCC version. This avoids using old headers left over from
# previous tool chain installations.
GCC_CXX_INCLUDES
?=
\
$(
addprefix
\
-isystem
$(
lastword
$(
sort
\
$(
foreach pat,
$(
GCC_CXX_INCLUDE_PATTERNS
)
,
$(
wildcard
$(
pat
)))))
,
\
/. /
$(
TARGET_ARCH
)
/
$(
GCC_MULTI_DIR
)
/backward
\
)
# If nothing was found we will try to fall back to searching for a cross-gcc in
# the current PATH and use a relative path for the includes
ifeq
(,$(GCC_CXX_INCLUDES))
GCC_CXX_INCLUDES
:=
$(
addprefix
-isystem
,
$(
wildcard
$(
dir
$(
shell which
$(
PREFIX
)
gcc
))
../
$(
TARGET_TRIPLE
)
/include
))
endif
# Pass the includes to the C++ compilation rule in Makefile.base
export
CXXINCLUDES
+=
$(
GCC_CXX_INCLUDES
)
# Some C headers (e.g. limits.h) are located with the GCC libraries
GCC_C_INCLUDE_PATTERNS
?=
\
/usr/lib/gcc/
$(
TARGET_TRIPLE
)
/
*
/
\
#
GCC_C_INCLUDES
?=
\
$(
addprefix
-isystem
,
$(
wildcard
$(
addprefix
\
$(
lastword
$(
sort
\
$(
foreach pat,
$(
GCC_C_INCLUDE_PATTERNS
)
,
$(
wildcard
$(
pat
)))))
,
\
include include-fixed
)
\
))
# If nothing was found we will try to fall back to searching for the libgcc used
# by an installed cross-GCC and use its headers.
ifeq
(,$(GCC_C_INCLUDES))
GCC_C_INCLUDES
:=
$(
addprefix
-isystem
,
$(
wildcard
$(
addprefix
$(
dir
$(
shell
$(
PREFIX
)
gcc
-print-libgcc-file-name
))
, include include-fixed
)))
endif
export
INCLUDES
+=
$(
GCC_C_INCLUDES
)
This diff is collapsed.
Click to expand it.
sys/cpp11-compat/include/riot/mutex.hpp
+
1
−
1
View file @
ed2c9476
...
@@ -44,7 +44,7 @@ class mutex {
...
@@ -44,7 +44,7 @@ class mutex {
public:
public:
using
native_handle_type
=
mutex_t
*
;
using
native_handle_type
=
mutex_t
*
;
inline
constexpr
mutex
()
noexcept
:
m_mtx
{
0
}
{}
inline
constexpr
mutex
()
noexcept
:
m_mtx
{
{
0
}
}
{}
~
mutex
();
~
mutex
();
void
lock
();
void
lock
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment