/*
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2020-2020. All rights reserved.
* Description: Strictly control the compilation options not including options beginning with -Wno
* Author: os_build
* Create: 2020-03-05
*/

package config

import (
	"strings"
)

func init() {

	x86_64StrictCflags, _ := RemovePrefixFromList("-Wno-", x86_64Cflags)
	x86_64StrictCflags, _ = RemovePrefixFromList("-Werror=", x86_64StrictCflags)

	pctx.StaticVariable("ClangStrictCflags", strings.Join([]string{
		"-D__compiler_offsetof=__builtin_offsetof",

		// Emit address-significance table which allows linker to perform safe ICF. Clang does
		// not emit the table by default on Android since NDK still uses GNU binutils.
		"-faddrsig",

		// Force clang to always output color diagnostics. Ninja will strip the ANSI
		// color codes if it is not running in a terminal.
		"-fcolor-diagnostics",
	}, " "))

	pctx.StaticVariable("ClangStrictCppflags", strings.Join([]string{
		// Enable clang's thread-safety annotations in libcxx.
		// Turn off -Wthread-safety-negative, to avoid breaking projects that use -Weverything.
		"-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
	}, " "))


	pctx.StaticVariable("ClangStrictNoOverrideCflags", strings.Join([]string{
		"-Werror",
	}, " "))

	pctx.StaticVariable("X86_64StrictClangCflags", strings.Join(ClangFilterUnknownCflags(x86_64StrictCflags), " "))

}