From 833774664548775c9b1139aff2203afb571e8379 Mon Sep 17 00:00:00 2001 From: aleksijuvani Date: Wed, 13 Apr 2016 17:40:39 +0300 Subject: [PATCH] Fix optimize 'Debug' for clang The compiler flag '-Og' isn't valid for clang, so just turn optimizations off when 'Debug' is specified. --- src/tools/clang.lua | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/tools/clang.lua b/src/tools/clang.lua index 7c7b3224..cad94c1f 100644 --- a/src/tools/clang.lua +++ b/src/tools/clang.lua @@ -41,14 +41,39 @@ -- An array of C compiler flags. -- + clang.cflags = { + architecture = gcc.cflags.architecture, + flags = gcc.cflags.flags, + floatingpoint = gcc.cflags.floatingpoint, + strictaliasing = gcc.cflags.strictaliasing, + optimize = { + Off = "-O0", + On = "-O2", + Debug = "-O0", + Full = "-O3", + Size = "-Os", + Speed = "-O3", + }, + pic = gcc.cflags.pic, + vectorextensions = gcc.cflags.vectorextensions, + warnings = gcc.cflags.warnings + } + function clang.getcflags(cfg) - -- Just pass through to GCC for now - local flags = gcc.getcflags(cfg) + local flags = config.mapFlags(cfg, clang.cflags) + flags = table.join(flags, clang.getwarnings(cfg)) return flags end + function clang.getwarnings(cfg) + + -- Just pass through to GCC for now + return gcc.getwarnings(cfg) + + end + -- -- Build a list of C++ compiler flags corresponding to the settings