Migration checklist when moving from the XL-based front end to the Clang-based front end
Aside from invoking the legacy IBM® XL-based compiler front end, you can alternatively invoke the Clang-based front end provided by XL C/C++ by using the xlclang or xlclang++ invocation command. As the Clang-based front end provides enhancements described in Comparison between the XL-based and Clang-based front ends, you might want to move to xlclang/xlclang++. However, you must be aware of these differences during migration.
Binary compatibility of xlc/xlc++ and xlclang/xlclang++
Category | Case | Required action |
---|---|---|
Binary incompatibility case | For C++ source, object files generated by xlc++ and xlclang++ are not directly compatible as the XL-based and Clang-based front ends use different C++ standard libraries, run times, and object models. | You must recompile your legacy programs by using xlclang or xlclang++ to solve such binary incompatibility and link object files successfully. |
Binary compatibility case | For C source, object files generated by xlc, xlc++, xlclang, and xlclang++ are directly compatible when the symbols names in source files contain only the dollar sign and the characters from the basic character set. | No action is required. You do not need to recompile source files before you link these object files. |
Considerations when merging generated code of C++11 and C++03 or prior
You should treat C++11 as a new language that is not directly interoperable with C++03 or prior language levels.
- There might be two C++ run times active in a single process. Modifying state in the C++ runtime,
such as the
std::locale
settings, in both C++03 and C++11 modules results in undefined behavior. - Do not delete a pointer in a C++03 module, which was allocated in a C++11 module, or vice versa.
- Do not use direct C++ language calls between C++11 and C++03 or prior. Use C interfaces instead to call between C++11 and C++03 or prior.
- Do not catch C++ exceptions thrown from C++11 in C++03 or prior, or vice versa.
Discrepancies of option defaults between xlc/xlC and xlclang/xlclang++
Default on xlc/xlc++ | Default on xlclang/xlclang++ |
---|---|
-qnortti | -qrtti |
-qbitfields=unsigned | Bit fields are treated as signed . |
-qhalt=s | -Werror (-qhalt=w) is disabled. |
-qnothreaded | -qthreaded |
-qtmplinst=auto | -qtmplinst=none |
The following legacy macros are defined: __xlC__ ,
__xlC_ver__ , ![]() __IBMCPP__ ![]() ![]() __IBMC__ , and __xlc__ ![]() |
-qnoxlcompatmacros (These legacy macros are not defined.) |
-qvisibility=unspecified | -qnovisibility (All the visibility pragmas and attributes that are specified in the source are ignored. ) |
Changed predefined macros to identify XL C/C++ when invoked by xlclang/xlclang++
- The formerly predefined legacy macros, namely
__xlC__
,__xlC_ver__
,__IBMCPP__
,
__IBMC__
, and__xlc__
, are no longer predefined by default.
- Some new macros are introduced and predefined by default.
To ease your migration efforts, option -qxlcompatmacros is introduced, which defines the five legacy macros. Note that the compiler default for xlclang and xlclang++ invocations is -qnoxlcompatmacros, meaning that the five legacy macros are not predefined. You might need to specify the -qxlcompatmacros option when you migrate programs from IBM XL C/C++ for AIX, V13.1.3 or earlier releases to IBM XL C/C++ for AIX 16.1 that is invoked by xlclang or xlclang++.
Unsupported legacy XL options by xlclang/xlclang++
Option | xlclang (Compiling C) | xlclang++ (Compiling C++) |
---|---|---|
-xc++ | Unsupported | |
-g3, -g4, -g5, -g6, -g7, -g8, -g9 | Unsupported | Unsupported |
-ma | Unsupported | Unsupported |
-qalias=allptrs | noallptrs | global | noglobal | typeptr | notypeptr | Unsupported | Unsupported |
-qalign | Unsupported | Unsupported |
-qalignrulefor | Unsupported | Unsupported |
-qalloca | Unsupported | Unsupported |
-qasm=stdcpp | Unsupported | Unsupported |
-qassert | Unsupported | Unsupported |
-qattr | -qnoattr | Unsupported | Unsupported |
-qbitfields | Unsupported | Unsupported |
-qcinc | -qnocinc | Unsupported | Unsupported |
-qconcurrentupdate | -qnoconcurrentupdate | Unsupported | Unsupported |
-qcpluscmt | -qnocpluscmt | Unsupported | Unsupported |
-qc_stdinc | Unsupported | |
-qcpp_stdinc | Unsupported | |
-qdbcs | -qnodbcs | Unsupported | Unsupported |
-qdbxextra | -qnodbxextra | Unsupported | Unsupported |
-qdfp | -qnodfp | Unsupported | Unsupported |
-qdigraph | -qnodigraph | Unsupported | Unsupported |
-qdpcl | -qnodpcl | Unsupported | Unsupported |
-qfloat=dfpemulate | nodfpemulate | fltint | nofltint | hssngl |nohssngl | rndsngl | norndsngl | single | nosingle | Unsupported | Unsupported |
-qeh | Unsupported | |
-qenum | Unsupported | Unsupported |
-qextchk | -qnoextchk | Unsupported | Unsupported |
-qflag | Unsupported | Unsupported |
-qformat | -qnoformat | Unsupported | Unsupported |
-qgenproto | -qnogenproto | Unsupported | Unsupported |
-qhalt = i | e | s (C only) -qhalt = i | s (C++ only) |
Unsupported | Unsupported |
-qhaltonmsg | -qnohaltonmsg | Unsupported | Unsupported |
-qheapdebug | -qnoheapdebug | Unsupported | Unsupported |
-qignprag | Unsupported | Unsupported |
-qinfo | -qnoinfo | Unsupported | Unsupported |
-qinline=autothreshold | Unsupported | Unsupported |
-qipa=threads | nothreads | Unsupported | Unsupported |
-qisolated_call | Unsupported | Unsupported |
-qkeepinlines | Unsupported | |
-qkeyword | -qnokeyword | Unsupported | Unsupported |
-qlanglvl=classic | extended | saa | saal2 | feature_suboption (C
only) -qlanglvl=compat366 | strict98 | feature_suboption (C++ only) |
Unsupported | Unsupported |
-qldbl128 | -qnoldbl128 | Unsupported | Unsupported |
-qlistfmt | Unsupported | Unsupported |
-qlistopt | -qnolistopt | Unsupported | Unsupported |
-qlongdouble | -qnolongdouble | Unsupported | Unsupported |
-qlonglit | -qnolonglit | Unsupported | Unsupported |
-qlonglong | -qqnolonglong | Unsupported | Unsupported |
-qmacpstr | -qnomacpstr | Unsupported | Unsupported |
-qmakedep | Unsupported | Unsupported |
-qmaxerr | -qnomaxerr | Unsupported | Unsupported |
-qmbcs | -qnombcs | Unsupported | Unsupported |
-qnamemangling | Unsupported | Unsupported |
-qobjmodel | Unsupported | Unsupported |
-qoldpassbyvalue | -qnooldpassbyvalue | Unsupported | Unsupported |
-qoptdebug | -qnooptdebug | Unsupported | Unsupported |
-qppline | -qnoppline | Unsupported | Unsupported |
-qprint | -qnoprint | Unsupported | Unsupported |
-qpriority | Unsupported | |
-qproto | -qnoproto | Unsupported | Unsupported |
-qrestrict | -qnorestrict | Unsupported | Unsupported |
-qroptr | -qnoroptr | Unsupported | Unsupported |
-qrtti | Unsupported | |
-qshowinc | -qnoshowinc | Unsupported | Unsupported |
-qshowmacros = all | pre | nopre | Unsupported | Unsupported |
-qskipsrc | Unsupported | Unsupported |
-qsmp | -qnosmp | Unsupported | Unsupported |
-qsource | -qnosource | Unsupported | Unsupported |
-qsrcmsg | -qnosrcmsg | Unsupported | Unsupported |
-qstaticinline | -qnostaticinline | Unsupported | Unsupported |
-qstatsym | -qnostatsym | Unsupported | Unsupported |
-qsymtab | Unsupported | Unsupported |
-qtabsize | Unsupported | Unsupported |
-qtempinc | -qnotempinc | Unsupported | Unsupported |
-qtemplatedepth | Unsupported | |
-qtemplaterecompile | -qnotemplaterecompile | Unsupported | Unsupported |
-qtemplateregistry | -qnotemplateregistry | Unsupported | Unsupported |
-qtempmax | Unsupported | Unsupported |
-qnothreaded | Unsupported | Unsupported |
-qtmplinst= always | auto | noinline | Unsupported | Unsupported |
-qtmplparse | Unsupported | Unsupported |
-qtrigraph | -qnotrigraph | Unsupported | Unsupported |
-qtwolink | Unsupported | |
-qupconv | -qnoupconv | Unsupported | Unsupported |
-qutf | -qnoutf | Unsupported | Unsupported |
-qwarn0x | -qnowarn0x | Unsupported | Unsupported |
-qwarn64 | -qnowarn64 | Unsupported | Unsupported |
-qweaksymbol | -qnoweaksymbol | Unsupported | Unsupported |
-qxcall | -qnoxcall | Unsupported | Unsupported |
-qxref | -qnoxref | Unsupported | Unsupported |
For more information, see Supported IBM XL compiler options by different invocations.
Unsupported legacy XL pragmas by xlclang/xlclang++
IBM pragma | xlclang (Compiling C) | xlclang++ (Compiling C++) |
---|---|---|
#pragma alloca (C only) | Unsupported | Unsupported |
#pragma block_loop | Unsupported | Unsupported |
#pragma chars | Unsupported | Unsupported |
#pragma comment | Unsupported | Unsupported |
#pragma define (C++ only) | Unsupported | Unsupported |
#pragma instantiate (C++ only) | Unsupported | Unsupported |
#pragma do_not_instantiate (C++ only) | Unsupported | Unsupported |
#pragma enum | Unsupported | Unsupported |
#pragma expected_value | Unsupported | Unsupported |
#pragma fini (C only) | Unsupported | Unsupported |
#pragma hashome (C++ only) | Unsupported | Unsupported |
#pragma ibm iterations | Unsupported | Unsupported |
#pragma ibm max_iterations | Unsupported | Unsupported |
#pragma ibm min_iterations | Unsupported | Unsupported |
#pragma ibm snapshot | Unsupported | Unsupported |
#pragma implementation (C++ only) | Unsupported | Unsupported |
#pragma info | Unsupported | Unsupported |
#pragma init (C only) | Unsupported | Unsupported |
#pragma ishome (C++ only) | Unsupported | Unsupported |
#pragma isolated_call | Unsupported | Unsupported |
#pragma langlvl (C only) | Unsupported | Unsupported |
#pragma leaves | Unsupported | Unsupported |
#pragma loopid | Unsupported | Unsupported |
#pragma map | Unsupported | Unsupported |
#pragma mc_func | Unsupported | Unsupported |
#pragma namemangling (C++ only) | Unsupported | Unsupported |
#pragma namemanglingrule (C++ only) | Unsupported | Unsupported |
#pragma nofunctrace | Unsupported | Unsupported |
#pragma nosimd | Unsupported | Unsupported |
#pragma novector | Unsupported | Unsupported |
#pragma object_model (C++ only) | Unsupported | Unsupported |
#pragma operator_new (C++ only) | Unsupported | Unsupported |
#pragma options | Unsupported | Unsupported |
#pragma pass_by_value (C++ only) | Unsupported | Unsupported |
#pragma priority (C++ only) | Unsupported | Unsupported |
#pragma reg_killed_by | Unsupported | Unsupported |
#pragma report (C++ only) | Unsupported | Unsupported |
#pragma simd_level | Unsupported | Unsupported |
#pragma stream_unroll | Unsupported | Unsupported |
#pragma strings | Unsupported | Unsupported |
#pragma unroll | Unsupported | Unsupported |
#pragma nounroll | Unsupported | Unsupported |
#pragma unrollandfuse | Unsupported | Unsupported |
#pragma weak | Unsupported | Unsupported |
#pragma ibm independent_calls (C only) | Unsupported | Unsupported |
#pragma ibm permutation (C only) | Unsupported | Unsupported |
#pragma ibm schedule (C only) | Unsupported | Unsupported |
#pragma ibm sequential_loop (C only) | Unsupported | Unsupported |
#pragma omp atomic | Unsupported | Unsupported |
#pragma omp parallel | Unsupported | Unsupported |
#pragma omp for | Unsupported | Unsupported |
#pragma omp ordered | Unsupported | Unsupported |
#pragma omp parallel for | Unsupported | Unsupported |
#pragma omp section, #pragma omp sections | Unsupported | Unsupported |
#pragma omp parallel sections | Unsupported | Unsupported |
#pragma omp single | Unsupported | Unsupported |
#pragma omp master | Unsupported | Unsupported |
#pragma omp critical | Unsupported | Unsupported |
#pragma omp barrier | Unsupported | Unsupported |
#pragma omp flush | Unsupported | Unsupported |
#pragma omp threadprivate | Unsupported | Unsupported |
#pragma omp task | Unsupported | Unsupported |
#pragma omp taskyield | Unsupported | Unsupported |
#pragma omp taskwait | Unsupported | Unsupported |
For more information, see Supported IBM pragmas by different invocations.
Different built-in function names between xlc/xlC and xlclang/xlclang++
The names of the built-in functions supported by IBM XL C/C++ for AIX 16.1 that is
invoked by xlclang/xlclang++
are in the form of __builtin_name
while the names supported by
xlc/xlC are in the form of __name
. For example, you should use
__builtin_addex
when invoking xlclang/xlclang++
while __addex
when invoking xlc/xlC. Note that
names of the vector built-in
functions are the same across two front ends.
Unsupported GCC atomic memory access built-in functions by xlclang/xlclang++
IBM XL C/C++ for AIX 16.1 that is invoked by xlclang or xlclang++ does not support the following GCC atomic memory access built-in functions. Use the C++11 atomics features instead.
- Atomic fetch and operation functions
__sync_fetch_and_and
__sync_fetch_and_nand
__sync_fetch_and_or
__sync_fetch_and_xor
__sync_fetch_and_add
__sync_fetch_and_sub
- Atomic operation and fetch functions
__sync_and_and_fetch
__sync_nand_and_fetch
__sync_or_and_fetch
__sync_xor_and_fetch
__sync_add_and_fetch
__sync_sub_and_fetch
- Atomic compare and swap functions
__sync_val_compare_and_swap
__sync_bool_compare_and_swap
Unsupported decimal floating-point built-in functions by xlclang/xlclang++
IBM XL C/C++ for AIX 16.1 that is invoked by xlclang or xlclang++ does not support decimal floating-point built-in functions.
You can find these built-in functions at Decimal floating-point built-in functions.Changed usage for utility makeC++SharedLib and linkxlC
If you link binaries generated by the Clang-based front end of IBM XL C/C++ for AIX by using makeC++SharedLib or linkxlC, you must also specify -lc++ manually, in addition to the parameters you need, to make the makeC++SharedLib and linkxlC utilities work properly. If you link binaries generated by the XL-based front end, such requirement does not apply.