#
#     Copyright (c) 2017-2018, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#

# Compiler Configurations for C++
#

variable DEF_GNU_SOURCE is default();
variable DEFGNU is default();
variable DEFGNU2 is default();
variable DEFGNUC is default();
variable EMPTY is default();
variable SAVSTDLIB is default();

variable IGNORE_PREINCLUDES is default();
variable CFI_DIR is default();
# remove from the command line for pgc++ and allow pggpp1 to set  __CHAR_UNSIGNED__
set DEFUNSIGNED=;

variable STDPARDEFS is default($if($STDPARGPU,-D__NVCOMPILER_STDPAR_GPU -D_NVHPC_STDPAR_GPU -D_NVHPC_STDPAR_CUDA) $if($STDPARMC,-D__NVCOMPILER_STDPAR_MULTICORE -D_NVHPC_STDPAR_MULTICORE -D_NVHPC_STDPAR_OPENMP -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_OMP) $if($NOSTDPAR,-D_NVHPC_STDPAR_NONE));

variable DEBUGCPP is		# dwarf level for C++ front end
    default($DEBUGCPPDEF)
    help(Debug dwarf level for C++);

variable DEBUGCPPDEF is		# default dwarf level for C++ front end
    default()
    help(Default debug dwarf level for C++);

variable RW is
    default();

variable PSTL is
    hide default(0);

variable COROUTINES is
    hide default(0);

switch -fpermissive is
    help(Disable warnings)
    helpgroup(overall)
    set(INFORM=-inform severe)
    append(CPP1ARGS=-w)
    set(NOWARN=YES);

switch -ftemplate-depth=arg is
    help(Set maximum template instantiation depth. Set to 0 for infinite depth)
    helpgroup(overall)
    append(CPP1ARGS=--pending_instantiations $arg);

switch -ftemplate-backtrace-limit=arg is
    help(Set maximum number of template instantiate notes for a single warning or error. The default value is 10, a value of 0 means no limit)
    helpgroup(overall)
    append(CPP1ARGS=--context_limit $arg);

switch -fcoroutines is hide
    help(enable coroutine support)
    helpgroup(language)
    append(CPP1ARGS=--set_flag coroutines)
    set(COROUTINES=1);

#-------------------

switch --actual_o_file$file is
    help(Name actual object file)
    helpgroup(overall)
    append(CPP1ARGS=--actual_o_file $path($file));

switch --alternative_tokens is
    help(Allow digraphs) helpname(--[no_]alternative_tokens)
    helpgroup(language)
    append(CPP1ARGS=--alternative_tokens);
switch --no_alternative_tokens is
    help(Disallow digraphs) hide
    helpgroup(language)
    append(CPP1ARGS=--no_alternative_tokens);

switch --anachronisms is
    help(C++ anachronisms) helpname(--[no_]anachronisms)
    helpgroup(language)
    append(CPP1ARGS=--anachronisms);
switch --no_anachronisms is
    help(No C++ anachronisms) hide
    helpgroup(language)
    append(CPP1ARGS=--no_anachronisms);

switch --array_new_and_delete is
    help(Enable array new and delete) helpname(--[no_]array_new_and_delete)
    helpgroup(language)
    append(CPP1ARGS=--array_new_and_delete);
switch --no_array_new_and_delete is
    help(Disable array new and delete) hide
    helpgroup(language)
    append(CPP1ARGS=--no_array_new_and_delete);

switch --auto_instantiation is
    help(Automatic template instantiation mode) helpname(--[no_]auto_instantiation)
    helpgroup(language)
    append(CPP1ARGS=--auto_instantiation);
switch --no_auto_instantiation is
    help(Disable automatic template instantiation) hide
    helpgroup(language)
    append(CPP1ARGS=--no_auto_instantiation);

switch --bool is
    help(Allow bool as keyword) helpname(--[no_]bool)
    helpgroup(language)
    append(CPP1ARGS=--bool);
switch --no_bool is
    help(Don't allow bool as keyword) hide
    helpgroup(language)
    append(CPP1ARGS=--no_bool);

switch --brief_diagnostics is
    help(Suppress diagnostic source printout) helpname(--[no_]brief_diagnostics)
    helpgroup(language)
    append(CPP1ARGS=--brief_diagnostics);
switch --no_brief_diagnostics is
    help(Don't suppress diagnostic source printout) hide
    helpgroup(language)
    append(CPP1ARGS=--no_brief_diagnostics);

switch -fdiagnostics-color is
    help(Colorize compiler diagnostics) helpname(-f[no-]diagnostics-color)
	keyword(
        always(
            help(Force enable color diagnostics)
            append(CPP1ARGS=--colors)
            append(CPP1ARGS=--force_colors)
        )
        never(
            help(Force disable color diagnostics)
            append(CPP1ARGS=--no_colors)
        )
        auto(
            help(Enable color diagnostics if supported by the terminal)
        )
	)
	onekeyword
	nokeyword(
	    help(Same as -fdiagnostics-color=always)
        append(CPP1ARGS=--colors)
        append(CPP1ARGS=--force_colors)
    );
switch -fno-diagnostics-color is
    hide
    shorthand(-fdiagnostics-color=never);

switch -fcolor-diagnostics is hide
	keyword(
        always(
            append(CPP1ARGS=--colors)
            append(CPP1ARGS=--force_colors)
        )
        never(
            append(CPP1ARGS=--no_colors)
        )
        auto()
	)
	onekeyword
	nokeyword(
        append(CPP1ARGS=--colors)
        append(CPP1ARGS=--force_colors)
    );
switch -fno-color-diagnostics is hide
    shorthand(-fcolor-diagnostics=never);

switch --building_runtime is hide
    helpgroup(language)
    append(CPP1ARGS=--building_runtime);

switch --builtin is
    helpname(--[no]builtin)
    helpgroup(language)
    append(CPP1ARGS=--builtin);
switch --nobuiltin is
    helpgroup(language)
    hide
    append(CPP1ARGS=--nobuiltin);

switch --c is hide
    help(C dialect is ANSI)
    helpgroup(language)
    set(IS_CPLUS=0)
    set(DIALECT_FLAG=--c)
    set(GNU_EXTENSIONS=0)
    set(EXCEPTIONS_ENABLED=0)
    set(C_ONLY=1)
    append(DIALECTARGS=--c);

switch "--c++98" is helpgroup(language) shorthand(--c++03);

switch "--c++03" is
    help(C++98/C++03 language dialect)
    helpgroup(language)
    set(IS_CPLUS=1)
    set(DIALECT_FLAG=--c++03)
    set(GNU_EXTENSIONS=0)
    append(DIALECTARGS=--c++03);

switch "--c++11" is
    help(C++11 language dialect)
    helpgroup(language)
    set(IS_CPLUS=1)
    set(DIALECT_FLAG=--c++11)
    set(GNU_EXTENSIONS=0)
    append(DIALECTARGS=--c++11);

switch "--c++0x" is hide shorthand(--c++11);

switch "--c++14" is
    help(C++14 language dialect)
    helpgroup(language)
    set(IS_CPLUS=1)
    set(DIALECT_FLAG=--c++14)
    set(GNU_EXTENSIONS=0)
    append(DIALECTARGS=--c++14);

switch "--c++1y" is hide shorthand(--c++14);

switch "--c++17" is
    help(C++17 language dialect)
    helpgroup(language)
    set(IS_CPLUS=1)
    set(DIALECT_FLAG=--c++17)
    set(GNU_EXTENSIONS=0)
    append(DIALECTARGS=--c++17);

switch "--c++1z" is hide shorthand(--c++17);

switch "--c++20" is
    help(C++20 language dialect)
    helpgroup(language)
    set(IS_CPLUS=1)
    set(DIALECT_FLAG=--c++20)
    set(GNU_EXTENSIONS=0)
    append(DIALECTARGS=--c++20);

switch "--c++2a" is hide shorthand(--c++20);

switch "--c++23" is
    help(C++23 language dialect)
    helpgroup(language)
    set(IS_CPLUS=1)
    set(DIALECT_FLAG=--c++23)
    set(GNU_EXTENSIONS=0)
    append(DIALECTARGS=--c++23);

switch -cppsuffix=suff is early
    help(Define a C++ suffix)
    helpgroup(language)
    append(USERCPPSUFFIX=$suff);

switch -cusuffix=suff is early
    hide
    help(Define a CUDA suffix)
    helpgroup(language)
    append(USERCUSUFFIX=$suff);

switch --set_compress_names$arg is
    help(Set length of C++ compressed names)
    helpgroup(language)
    helpname(--set_compress_names)
    append(CPP1ARGS=--set_compress_names $arg);

switch --compress_names is
    help(Compress long names)
    helpgroup(language)
    helpname(--[no_]compress_names)
    append(CPP1ARGS=--compress_names);

switch --no_compress_names is hide
    help(Do not compress long names)
    helpgroup(language)
    append(CPP1ARGS=--no_compress_names);

switch --comments is
    help(Preserve comments)
    helpgroup(language)
    append(CPP1ARGS=--comments);

switch -define_macro$macro is
    help(Define a preprocessor macro)
    helpgroup(prepro)
    append(USRDDEF=-D$macro)
    append(USRDEFDEF=-def $macro);
switch -undefine_macro$macro is
    help(Undefine a preprocessor macro)
    helpgroup(prepro)
    append(USRDDEF=-U$macro)
    append(USRDEFDEF=-undef $macro);

switch --definition_list_file$arg is
    if($index($TARGET,win64,win64-llvm))
    help(Create definition list file)
    helpgroup(language)
    append(CPP1ARGS=--definition_list_file $arg);

switch --dependencies is
    help(List makefile dependencies)
    helpgroup(prepro)
    append(CPP1ARGS=--dependencies);

switch --dependencies_quoted_only is
    help(List makefile dependencies with quoted include files only)
    helpgroup(prepro)
    append(CPP1ARGS=--dependencies_quoted_only);

switch --dependencies_to_file $file is
    help(Print makefile dependencies to file)
    helpgroup(prepro)
    set(file=$mknewfile($path($file)))
    append(CPP1ARGS=--dependencies_to_file $file);

switch --dependencies_to_file_quoted_only $file is
    help(Print makefile dependencies with quoted include files only to file)
    helpgroup(prepro)
    set(file=$mknewfile($path($file)))
    append(CPP1ARGS=--dependencies_to_file_quoted_only $file);

switch --dependencies_to_stdout is
    help(Print makefile dependencies to stdout)
    helpgroup(prepro)
    append(CPP1ARGS=--dependencies_to_stdout);

switch --dependencies_to_stdout_quoted_only is
    help(List makefile dependencies w/ quoted include files only to stdout)
    helpgroup(prepro)
    append(CPP1ARGS=--dependencies_to_stdout_quoted_only);

switch --distinct_template_signatures is
    help(Enable distinct name mangling for templates and nontemplates)
    helpgroup(language)
    helpname(--[no_]distinct_template_signatures)
    append(CPP1ARGS=--distinct_template_signatures);
switch --no_distinct_template_signatures is
    help(Disable distinct name mangling for templates and nontemplates) hide
    helpgroup(language)
    append(CPP1ARGS=--no_distinct_template_signatures);

switch --dollar is
    help(Allow dollar sign in identifiers)
    helpgroup(language)
    append(CPP1ARGS=--dollar);

switch --dump_il is hide
    help(Dump front end IL)
    helpgroup(language)
    append(CPP1ARGS=--dump_il);

switch --dwarf2 is
    help(Generate dwarf2 debug output)
    helpgroup(debug)
    set(DEBUG=-debug $DEFDEBUG $DEBUG2)
    set(DODWARF=)
    set(DEBUGSET=1)
    set(DEBUGFLAG=1)
    set(DEBUG2=-x 120 0x200)
    append(F901ARGS=-x 49 0x1000)
    append(CPP1ARGS=-g $DEBUGCPP)
    set(DEBUGCPP=--dwarf2)
    min(OPTLEVELINITDEF=0);

switch --enum_overloading is
    help(Enable operator overloading on enum types)
    helpgroup(language)
    helpname(--[no_]enum_overloading)
    append(CPP1ARGS=--enum_overloading);
switch --no_enum_overloading is
    help(Disable operator overloading on enum types) hide
    helpgroup(language)
    append(CPP1ARGS=--no_enum_overloading);

switch --exceptions is
    helpname(--[no_]exceptions)
    help(Enable (disable) C++ exceptions)
    helpgroup(language)
    set(EXCEPTIONS_ENABLED=1)
    append(CPP1ARGS=--exceptions);
switch --no_exceptions is hide
    help(Disable C++ exceptions)
    helpgroup(language)
    set(EXCEPTIONS_ENABLED=0)
    append(CPP1ARGS=--no_exceptions);

switch --explicit is
    help(Recognize explicit keyword) helpname(--[no_]explicit)
    helpgroup(language)
    append(CPP1ARGS=--explicit);
switch --no_explicit is
    help(Don't recognize explicit keyword) hide
    helpgroup(language)
    append(CPP1ARGS=--no_explicit);

switch --extern_inline is hide
    help(Enable extern inline) helpname(--[no_]extern_inline)
    helpgroup(language)
    append(CPP1ARGS=--extern_inline);
switch --no_extern_inline is
    help(Disable extern inline) hide
    helpgroup(language)
    append(CPP1ARGS=--no_extern_inline);

switch --for_init_diff_warning is
    help(Enable warning when new-style for-init scoping differs from old-style)
    helpgroup(language)
    helpname(--[no_]for_init_diff_warning)
    append(CPP1ARGS=--for_init_diff_warning);
switch --no_for_init_diff_warning is
    help(Disable warning when new-style for-init scoping differs from old-style)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_for_init_diff_warning);

switch --force_vtbl is
    help(Force virtual function table definition)
    helpgroup(language)
    append(CPP1ARGS=--force_vtbl);

switch --gnu_extensions is
    help(Allow GNU C++ extensions)
    helpgroup(language)
    append(CPP1ARGS=--gnu_extensions);

switch --gnu_version$arg is
    help(Set GNU C++ compatibility version )
    helpgroup(language)
    helpname(--gnu_version)
    append(CPP1ARGS=--gnu_version $arg -D__pgnu_vsn=$arg)
    append(CPP2ARGS=-gnuvsn $arg);

switch --gnu is
    help(Default: Generate GNU compatible C++ code, link with GNU lbraries)
    helpgroup(language)
    helpname(--gnu);

switch --edg is
    help(Deprecated: Generate EDG compatible C++ code, link with EDG libraries)
    helpgroup(language)
    helpname(--edg) ;

switch --microsoft_version$arg is
    help(Set Microsoft C++ compatibility version )
    helpgroup(language)
    helpname(--microsoft_version)
    append(CPP1ARGS=--microsoft_version $arg);

switch --zc_eh is hide
    warning(The option --zc_eh no longer has any effect and is ignored)
    help(Ignored);

switch --guiding_decls is
    help(Enable guiding declarations of template functions)
    helpgroup(language)
    helpname(--[no_]guiding_decls)
    append(CPP1ARGS=--guiding_decls);

switch --no_guiding_decls is
    help(Disable guiding declarations of template functions)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_guiding_decls);

switch --ieee$num is
    help(IEEE floating point support)
    helpgroup(language)
    append(CPP1ARGS=$if($isnum($num),--ieee $num,$error(Illegal option to --ieee)));

switch --ignore_pragma_encrypt is hide
    help(Ignore pragma encryption)
    helpgroup(language)
    append(CPP1ARGS=--ignore_pragma_encrypt);

switch --ii_file$file is
    if($index($TARGET,win64,win64-llvm))
    help(Name instantiation information file)
    helpgroup(language)
echo(Please check --ii_file switch)
    append(CPP1ARGS=--ii_file $file);

switch --implicit_include is
    help(Implicit template inclusion) helpname(--[no_]implicit_include)
    helpgroup(language)
    append(CPP1ARGS=--implicit_include);
switch --no_implicit_include is
    help(No implicit template inclusion) hide
    helpgroup(language)
    append(CPP1ARGS=--no_implicit_include);

switch --implicit_typename is
    help(Enable implicit determination of whether a template dependent name is a type)
    helpgroup(language)
    helpname(--[no_]implicit_typename)
    append(CPP1ARGS=--implicit_typename);
switch --no_implicit_typename is
    help(Disable implicit determination of whether a template dependent name is a type)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_implicit_typename);

switch --include_directory$incdir is
    help(Add directory to include file search path)
    helpgroup(prepro)
    append(USRINC=$path($incdir));

# C++ doesn't support --inlining
#switch --inlining is
#	help(Do minimal inlining)
#	append(CPP1ARGS=--inlining);
#switch --no_inlining is
#	help(Don't do minimal inlining)
#	append(CPP1ARGS=--no_inlining);

switch --instantiate is
    if($index($TARGET,win64,win64-llvm))
    help(Template instantiation mode)
    helpgroup(language)
    set(imode=)
    keyword(
	    none(set(imode=none))
	    all(set(imode=all))
	    used(set(imode=used))
	    local(set(imode=local))
	   )
    onekeyword
    append(CPP1ARGS=--instantiate $imode);

switch --instantiation_dir$dir is
    helpgroup(language)
    append(RW=$warning( instantiation_dir switch is deprecated));

switch --jmp_buf_num_elements$num is hide
    help(Maximum jump buffer size)
    helpgroup(language)
    append(CPP1ARGS=$if($isnum($num),--jmp_buf_num_elements $num,$error(Illegal number option to --jmp_buf_num_elements)));

switch --late_tiebreaker is
    help(Early vs. Late overload resolution tiebreaker)
    helpgroup(language)
    append(CPP1ARGS=--late_tiebreaker);
switch --early_tiebreaker is
    help(Early vs. Late overload resolution tiebreaker)
    helpgroup(language)
    append(CPP1ARGS=--early_tiebreaker);

switch --list$file is
    help(Set an list file name)
    helpgroup(language)
    append(CPP1ARGS=--list $path($file));

switch --llalign is
    help(Align long long on integer boundary) helpname(--[no_]llalign)
    helpgroup(language)
    append(CGARGS=-y 119 0x100000)
    append(CPP1ARGS=--llalign);
switch --nollalign is
    help(Don't align long long on integer boundary) hide
    helpgroup(language)
    append(CGARGS=-x 119 0x100000)
    append(CPP1ARGS=--nollalign);

switch --long_lifetime_temps is
    help(Long lifetime temps)
    helpgroup(language)
    append(CPP1ARGS=--long_lifetime_temps);
switch --short_lifetime_temps is
    help(Short lifetime temps)
    helpgroup(language)
    append(CPP1ARGS=--short_lifetime_temps);

switch --long_preserving_rules is
    helpname(--[no_]long_preserving_rules)
    helpgroup(language)
    append(CPP1ARGS=--long_preserving_rules);
switch --no_long_preserving_rules is hide
    helpgroup(language)
    append(CPP1ARGS=--no_long_preserving_rules);

switch --namespaces is
    help(Enable namespaces) helpname(--[no_]namespaces)
    helpgroup(language)
    append(CPP1ARGS=--namespaces);

switch --need_exception_spec is hide
    warning(The option --need_exception_spec is ignored)
    help(Ignored);

switch --no_namespaces is
    help(Disable namespaces) hide
    helpgroup(language)
    append(CPP1ARGS=--no_namespaces);

switch --no_il_lowering is hide
    help(Don't lower IL)
    helpgroup(language)
    append(CPP1ARGS=--no_il_lowering);

switch --no_line_commands is early
    help(Preprocess_only, no "#line" commands)
    helpgroup(prepro)
    append(CPP1ARGS=--no_line_commands -D__PREPROCESS_ONLY__)
    set(KEEPPREPRO=YES)
    set(CPP1ONLY=YES)
    set(PREPROCONLY=YES)
    set(NOASM=YES)
    stopafter(Compile)
    set(COMPILEONLY=YES);

switch --no_use_before_set_warnings is
    help(Suppress warning messages)
    helpgroup(language)
    append(CPP1ARGS=--no_use_before_set_warnings);

switch --no_warnings is
    help(Suppress warning messages)
    helpgroup(language)
    set(INFORM=-inform severe)
    set(NOWARN=YES);

switch --nonconst_ref_anachronism is
    help(Reference to nonconst is allowed to bind to class rvalue)
    helpgroup(language)
    helpname(--[no_]nonconst_ref_anachronism)
    append(CPP1ARGS=--nonconst_ref_anachronism);
switch --no_nonconst_ref_anachronism is
    help(Reference to nonconst is not allowed to bind to class rvalue)
    helpgroup(language)
    hide
    append(CPP1ARGS=--nonconst_ref_anachronism);

switch --nonstd_qualifier_deduction is
    helpname(--[no_]nonstd_qualifier_deduction)
    helpgroup(language)
    append(CPP1ARGS=--nonstd_qualifier_deduction);
switch --no_nonstd_qualifier_deduction is hide
    helpgroup(language)
    append(CPP1ARGS=--no_nonstd_qualifier_deduction);

switch --old_c is hide
    help(Assume old pcc dialect)
    helpgroup(language)
    append(CARGS=-x 2 0x400)
    append(CPP1ARGS=--old_c);

switch --pedantic is
    help(Print warnings from included <system header files>)
    helpgroup(language)
    append(CPP1ARGS=--pedantic);
switch --old_for_init is
    help(Enable old-style for-init scoping)
    helpgroup(language)
    append(CPP1ARGS=--old_for_init);
switch --new_for_init is
    help(Disable old-style for-init scoping)
    helpgroup(language)
    append(CPP1ARGS=--new_for_init);

switch --old_specializations is
    help(Enable old-style specialization declarations)
    helpgroup(language)
    helpname(--[no_]old_specializations)
    append(CPP1ARGS=--old_specializations);
switch --no_old_specializations is
    help(Enable old-style specialization declarations)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_old_specializations);

switch --old_style_processing is hide
    help(Enable PCC style preprocessing)
    helpgroup(language)
    append(CPP1ARGS=--old_style_processing);

switch --one_instantiation_per_object is
    helpgroup(language)
    append(RW=$warning( one_instantiation_per_object switch is deprecated));

switch --pending_instantiations$num is
    if($index($TARGET,win64,win64-llvm))
    help(Number of pending instantiations of a template that may be in progress at one time)
    helpgroup(language)
    append(CPP1ARGS=$if($isnum($num),--pending_instantiations $num,$error(Illegal operand to --pending_instanations)));

switch --preinclude$name is
    help(File to include at start of compilation)
    helpgroup(language)
    append(CPP1ARGS=--preinclude $path($name));

switch --preprocess is early
    help(Preprocess only with "#line" directives)
    helpgroup(prepro)
    append(CPP1ARGS=--preprocess -D__PREPROCESS_ONLY__)
    set(KEEPPREPRO=YES)
    set(CPP1ONLY=YES)
    set(PREPROCONLY=YES)
    set(HANDLEOTHER=$OTHERPREPROCESS)
    set(NOASM=YES)
    stopafter(Compile)
    set(COMPILEONLY=YES);

switch --reflection is hide
    help(Enable experimental C++ reflection support)
    helpgroup(language)
    append(CPP1ARGS=--set_flag=reflection);

switch --remove_instantiation_flags is hide
    helpgroup(language)
    append(CPP1ARGS=--remove_instantiation_flags);

switch --remove_unneeded_entities is
    help(Remove unneeded IL entries) helpname(--[no_]remove_unneeded_entities)
    helpgroup(language)
    append(CPP1ARGS=--remove_unneeded_entities);
switch --no_remove_unneeded_entities is
    help(Don't remove unneeded IL entries) hide
    helpgroup(language)
    append(CPP1ARGS=--no_remove_unneeded_entities);

switch --restrict is hide
    help(Treat \"restrict\" as a keyword) helpname(--[no]restrict)
    helpgroup(language)
    append(CPP1ARGS=--restrict);
switch --norestrict is hide
    help(Don't treat \"restrict\" as a keyword)
    helpgroup(language)
    append(CPP1ARGS=--no_restrict);

switch --rtti is
    help(Enable (disable) runtime type information) helpname(--[no_]rtti)
    helpgroup(language)
    append(CPP1ARGS=--rtti);
switch --no_rtti is
    help(Disable runtime type information) hide
    helpgroup(language)
    append(CPP1ARGS=--no_rtti);
switch -frtti is
    help(Enable (disable) runtime type information) helpname(--[no_]rtti)
    helpgroup(language)
    append(CPP1ARGS=--rtti);
switch -fno-rtti is
    help(Disable runtime type information) hide
    helpgroup(language)
    append(CPP1ARGS=--no_rtti);

switch --size_t_int_kind is hide
    help(Give size of int)
    helpgroup(language)
    keyword(
	    ulong(append(CPP1ARGS=--size_t_int_kind ulong))
	    uint(append(CPP1ARGS=--size_t_int_kind uint))
	    ulong_long(append(CPP1ARGS=--size_t_int_kind ulong_long))
	   )
    onekeyword;

switch --special_subscript_cost is hide
    help(Enable special weighting for [] conversion in overload resolution)
    helpgroup(language)
    helpname(--[no_]special_subscript_cost)
    append(CPP1ARGS=--special_subscript_cost);
switch --no_special_subscript_cost is
    help(Disable special weighting for [] conversion in overload resolution)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_special_subscript_cost);

switch --strict is
    if($index($TARGET,win64,win64-llvm))
    help(Issue error if nonANSI)
    helpgroup(language)
    append(CPP1ARGS=--strict);

switch --strict_warnings is
    if($index($TARGET,win64,win64-llvm))
    help(Issue warning if nonANSI)
    helpgroup(language)
    append(CPP1ARGS=--strict_warning);

switch --suppress_instantiation_flags is hide
    help(Suppress instantiation flags)
    helpgroup(language)
    append(CPP1ARGS=--suppress_instantiation_flags);

switch --suppress_vtbl is
    help(Suppress virtual function table definition)
    helpgroup(language)
    append(CPP1ARGS=--suppress_vtbl);

switch --svr4 is hide
    help(Assume SVR4 compatibility mode -- implies ANSI compatibility)
    helpgroup(language)
    helpname(--[no_]svr4)
    append(CPP1ARGS=--svr4);
switch --no_svr4 is
    help(Don't assume SVR4 compatibility mode -- implies ANSI compatibility)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_svr4);

switch --template_info_file$file is
    helpgroup(language)
    append(RW=$warning( template_info_file switch is deprecated));

switch --timing is
    help(Display C++ front end compilation times)
    helpgroup(language)
    append(CPP1ARGS=--timing);

switch --trace_includes is
    help(List include files)
    helpgroup(language)
    append(CPP1ARGS=--trace_includes);

switch --typename is
    help(Enable typename) helpname(--[no_]typename)
    helpgroup(language)
    append(CPP1ARGS=--typename);
switch --no_typename is
    help(Disable typename) hide
    helpgroup(language)
    append(CPP1ARGS=--no_typename);

switch --using_std is
    help(Enable implicit use of standard namespace by runtime)
    helpgroup(language)
    helpname(--[no_]using_std)
    append(CPP1ARGS=--using_std);
switch --no_using_std is
    help(Disable implicit use of standard namespace by runtime)
    helpgroup(language)
    hide
    append(CPP1ARGS=--no_using_std);

#-------------------

switch "-$" is
    help(Allow dollar sign in names)
    helpgroup(language)
    append(CPP1ARGS="-$");


switch -A is
    help(Accept ANSI standard C++)
    helpgroup(language)
    append(CPP1ARGS=-A)
    append(USRDDEF=-D__ANSI_CONFORM)
    append(USRDEFDEF=-def __ANSI_CONFORM);

switch -a is
    help(Accept ANSI standard C++ with warnings)
    helpgroup(language)
    append(CPP1ARGS=-a)
	append(USRDDEF=-D__ANSI_CONFORM)
	append(USRDEFDEF=-def __ANSI_CONFORM);

switch +c is hide
	help(Define unix)
	helpgroup(language)
	append(CPP1ARGS=+c)
	append(USRDDEF=-Dunix)
	append(USRDEFDEF=-def unix);


switch -dwarf is
	help(Generate dwarf debug output)
	helpgroup(debug)
	append(CPP1ARGS=-f)
	min(OPTLEVEL=0)
	set(DEBUG=-debug $DEFDEBUG)
	set(DODWARF=)
	set(DEBUGSET=1)
	set(DEBUGFLAG=1);

switch +d is hide
	help(Disable inline expansion)
	helpgroup(language)
	append(CPP1ARGS=+d)
	append(USRDDEF=-Dunix)
	append(USRDEFDEF=-def unix);

switch -e$ is
	help(Set error limit)
	helpgroup(language)
	optional(arg)
	append(CPP1ARGS=-e$arg);

# no-op for now
switch -print-search-dirs is
	help()
	helpgroup(overall);

switch +i is hide
	help(Keep intermediate .c file)
	helpgroup(language)
	set(KEEPIL=YES);

switch -Mnodtypeq is
	help()
	helpgroup(language)
	append(CPP2ARGS=-Mnodtypeq);

switch -N is early
	help(Preprocess only)
	helpgroup(prepro)
	append(CPP1ARGS=-N)
	set(KEEPPREPRO=YES)
	set(PREPROCONLY=YES)
	set(HANDLEOTHER=$OTHERPREPROCESS)
	set(CPP1ONLY=YES)
	set(NOASM=YES)
	stopafter(Compile)
	set(COMPILEONLY=YES);

switch -no_prelink is
	help(Don't run CPP prelink)
	helpgroup(linker);


switch -patch is hide help(Ignored, for compatibility only) helpgroup(language);
switch -pta is hide help(Ignored, for compatibility only) helpgroup(language);
switch -ptn is hide help(Ignored, for compatibility only) helpgroup(language);
switch -ptr is hide help(Ignored, for compatibility only) helpgroup(language);
switch -pts is hide help(Ignored, for compatibility only) helpgroup(language);
switch -ptv is hide help(Ignored, for compatibility only) helpgroup(language);

switch +p is hide
	help(Disallow anachronisms)
	helpgroup(language)
	append(CPP1ARGS=--no_anachronisms);

switch -t is
	if($index($TARGET,win64,win64-llvm))
	help(Control template instantiation)
	helpgroup(language)
	keyword(
	all(
	    help(Instantiate all template functions)
	    append(CPP1ARGS=-tall) )
	none(
	    help(Do not instantiate any template functions)
	    append(CPP1ARGS=-tnone) )
	used(
	    help(Instantiate only template functions that are used)
	    append(CPP1ARGS=-tused) )
	local(
	    help(Instantiate only template functions that are used and force them to be local)
	    append(CPP1ARGS=-tlocal) )
	)
	onekeyword
	nokeyword(
	    help(Same as -tused)
	    append(CPP1ARGS=-tused) )
	append(CPP1ARGS=-tused);

switch +x lang is hide help(Ignored, for compatibility only)
	helpgroup(language);

switch -X$file is
	help(Generate cross reference information into file)
	helpgroup(language)
	append(CPP1ARGS=-X$path($file));

switch -YP,dir is
	help(Add standard library directory)
	helpgroup(linker)
	append(LDARGS=-YP$path($dir));

set CSUFFIX=;
set CPPSUFFIX=c i cpp $CPPCUSUFFIX;
set CUSUFFIX=cu;
set CUPSUFFIX=cup;
variable EMBEDDEDSTDLIB is hide default(ste);
variable EMBEDDEDCPPLIB is hide default(EC);
set DEFCPPLIBS=$LIBSW$DEFLANGSTDLIB $BLTINLIBS $if($DEFCPPLIB,$LIBSW$DEFCPPLIB) $CPPSTDLIBS;

replace switch -x is
  help(Specify the language for any following input files, instead of letting the compiler choose based on suffix. Turn off with -x none)
  helpgroup(overall)
  early
  keyword(
    c( set(OVERRIDESUFFIX=c) )
    cpp( set(OVERRIDESUFFIX=cpp) )
    cu(hide set(OVERRIDESUFFIX=cu) )
    cup(hide set(OVERRIDESUFFIX=cup) )
    "c++"=cpp
    i( set(OVERRIDESUFFIX=i) )
    "cpp-output"=i
    asm( set(OVERRIDESUFFIX=asm) )
    assembler=asm
    ASM( set(OVERRIDESUFFIX=ASM) )
    "assembler-with-cpp"=ASM
    none( set(OVERRIDESUFFIX=) )
  )
  onekeyword;

# Supported nvcc options in nvc++
switch -Xcompiler args is
    early
    erase
    help(Specify options directly to the compiler/preprocessor.)
    helpgroup(overall)
    switcharg
    append(ADDARGS=$replace($args,",", ))
    append(RMARGS=--compiler-options=$args --compiler-options $args -Xcompiler=$args -Xcompiler $args)
    set(MUSTRESTART=1)
    restart($COMPBASE/$COMPSYS/$COMPVER/$COMPBBIN);

switch --compiler-options args is 
    switcharg
    shorthand(-Xcompiler $args);

switch --linker-options args is
    switcharg
    shorthand(-Xlinker $args);

# Unsupported nvcc options in nvc++
variable UNSUPPORTED_NVCC_TARGET_OPTIONS is default(0);
error($if($UNSUPPORTED_NVCC_TARGET_OPTIONS,NVC++ does not support NVCC’s device architecture targeting options. NVC++ will automatically compile for the GPU installed in this system by default. To explicitly choose a device architecture\, use -gpu=ccXX instead\, where XX is the desired compute capability.));

switch --generate-code=arg is hide
       set(UNSUPPORTED_NVCC_TARGET_OPTIONS=1);
switch -gencode=arg is hide shorthand(--generate-code=arg);

switch --gpu-architecture=arg is hide
       set(UNSUPPORTED_NVCC_TARGET_OPTIONS=1);
switch -arch=arg is hide shorthand(--gpu-architecture=arg);

switch --gpu-code=arg is hide
       set(UNSUPPORTED_NVCC_TARGET_OPTIONS=1);
switch -code=arg is hide shorthand(--gpu-code=arg);

switch --compiler-bindir $arg is hide
       fatal(The options --compiler-bindir/-ccbin are not supported. NVC++ is a unified heterogeneous compiler. It compiles both the host and device code. No separate host compiler can be provided.);
switch -ccbin arg is hide shorthand(--compiler-bindir arg);

switch -fcheck-new is
  help(Always check that the pointer allocated by operator new is non-null even when it is not necessary)
  helpgroup(language)
  helpname(-fcheck-new)
	append(CPP1ARGS=--check_new);

switch -fno-check-new is hide
	append(CPP1ARGS=--no_check_new);

switch --experimental-stdpar is
	help(Enable experimental Senders & Receivers implementation. Requires C++20 mode. GPU features require -stdpar=gpu.)
	helpgroup(target)
	append(COMPINCDIR=include-stdexec/experimental);
