Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

add '-target' to whitelist #121

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def parse_flags(build_log):
# -warnings (-Werror), but no assembler, etc. flags (-Wa,-option)
# -language (-std=gnu99) and standard library (-nostdlib)
# -word size (-m64)
flags_whitelist = ["-[iIDF].*", "-W[^,]*", "-std=[a-z0-9+]+", "-(no)?std(lib|inc)", "-m[0-9]+"]
flags_whitelist = ["-[iIDF].*", "-W[^,]*", "-std=[a-z0-9+]+", "-(no)?std(lib|inc)", "-m[0-9]+", "-target"]
flags_whitelist = re.compile("|".join(map("^{}$".format, flags_whitelist)))
flags = set()
line_count = 0
Expand All @@ -430,7 +430,7 @@ def parse_flags(build_log):
define_regex = re.compile("-D([a-zA-Z0-9_]+)=(.*)")

# Used to only bundle filenames with applicable arguments
filename_flags = ["-o", "-I", "-isystem", "-iquote", "-include", "-imacros", "-isysroot"]
filename_flags = ["-o", "-I", "-isystem", "-iquote", "-include", "-imacros", "-isysroot", "-target"]

# Process build log
for line in build_log:
Expand Down
1 change: 0 additions & 1 deletion fake-toolchain/Unix/arm-none-eabi-g++

This file was deleted.

14 changes: 14 additions & 0 deletions fake-toolchain/Unix/arm-none-eabi-g++
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@

elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@

else
echo "$@" >> $YCM_CONFIG_GEN_CXX_LOG -target arm-none-eabi
fi

1 change: 0 additions & 1 deletion fake-toolchain/Unix/arm-none-eabi-gcc

This file was deleted.

14 changes: 14 additions & 0 deletions fake-toolchain/Unix/arm-none-eabi-gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@

elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@

else
echo "$@" >> $YCM_CONFIG_GEN_CC_LOG -target arm-none-eabi
fi

1 change: 0 additions & 1 deletion fake-toolchain/Unix/avr-g++

This file was deleted.

16 changes: 16 additions & 0 deletions fake-toolchain/Unix/avr-g++
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

AVR_LIB=$(cat /tmp/avr_gcc_include)

if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@

elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@

else
echo "$@" >> $YCM_CONFIG_GEN_CXX_LOG -isystem $AVR_LIB -D__flash= --target=avr
fi

1 change: 0 additions & 1 deletion fake-toolchain/Unix/avr-gcc

This file was deleted.

16 changes: 16 additions & 0 deletions fake-toolchain/Unix/avr-gcc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

AVR_LIB=$(cat /tmp/avr_gcc_include)

if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@

elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@

else
echo "$@" >> $YCM_CONFIG_GEN_CC_LOG -isystem $AVR_LIB -D__flash= --target=avr
fi

11 changes: 11 additions & 0 deletions template.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,22 @@
import re
import subprocess

import os.path as p
import sys

DIR_OF_THIS = p.abspath(p.dirname(__file__))
sys.path.append(DIR_OF_THIS)

try:
from ycm_extra_manual_config import extra_flags
except ImportError:
extra_flags = []

flags = [
# INSERT FLAGS HERE
]

flags += extra_flags

def LoadSystemIncludes():
regex = re.compile(r'(?:\#include \<...\> search starts here\:)(?P<list>.*?)(?:End of search list)', re.DOTALL)
Expand Down