# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################
# pylint: disable=locally-disabled, invalid-name, missing-docstring
"""Intel posix compiler configuration for embedded
"""
from parts.config import ConfigValues, configuration


def map_default_version(env):
    return env['INTELC_VERSION']


config = configuration(map_default_version)

config.VersionRange(
    "7-*",
    append=ConfigValues(
        CCFLAGS=[
            # second level optimization
            '-Os',
            # prevent using built in stdlib replacement functions
            '-fno-builtin',
            '-fno-stack-protector',
            '-fomit-frame-pointer',
            '-fno-asynchronous-unwind-tables',
            # allow linker to optimize out not used stuff
            '-fdata-sections',
            '-ffunction-sections',
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################

"""Intel win32 compiler configurations release
"""
from parts.config import ConfigValues, configuration

def map_default_version(env):
    return env['MSVC_VERSION']

config = configuration(map_default_version)

config.VersionRange("7-*",
                    append=ConfigValues(
                        CCFLAGS=['/MP',
                                 '/GS',
                                 '/W4',
                                 '/wd4127',  # allow while (0)
                                 '/wd4592',  # VS2015U1 limitation
                                 #'/wd4366',  # ok unaligned &
                                 #'/wd4204',  # allow x= {a,b}
                                 #'/wd4221',  # allow x = {&y}
                                 '/Gy',
                                 '/Zc:wchar_t',
                                 '/Z7',
                                 '/O2',
Exemple #3
0
    """ Enable sanitizers
    Args:
        recover: Enable sanitizers recovery from errors found.
    """
    version_minimum = 6
    version_major = int(map_default_version(env).partition('.')[0])
    if version_major >= version_minimum:
        env.AppendUnique(CCFLAGS=[
            '-g', '-fsanitize=address,undefined', '-fno-sanitize=alignment',
            '-fno-sanitize=shift', '-fno-omit-frame-pointer'
        ])
        env.AppendUnique(LINKFLAGS=['-fsanitize=address,undefined'])
        if recover:
            env.AppendUnique(CCFLAGS=[
                '-fsanitize-recover=all', '-fsanitize-recover=address'
            ])
    else:
        raise RuntimeError(
            'Build with sanitizers is only supported for '
            'GXX version greater than {}'.format(version_minimum))


def post_process_func(env):
    if env.get('sanitizers', False):
        enable_sanitizers(env, env.get('sanitizers_recover', False))


config = configuration(map_default_version, post_process_func)

config.VersionRange("*")