mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-20 22:10:03 +08:00
Allow sym_diff.py to report non-zero for non-breaking ABI changes
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@292297 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,7 +22,8 @@ if (LIBCXX_HAS_ABILIST_CONFIGURATION)
|
||||
set(ABILIST_FILE "${CMAKE_CURRENT_LIST_DIR}/${TARGET_TRIPLE}.abilist")
|
||||
set(SYMDIFF_EXE "${LIBCXX_SOURCE_DIR}/utils/sym_check/sym_diff.py")
|
||||
add_custom_target(check-cxx-abilist
|
||||
${SYMDIFF_EXE} --only-stdlib-symbols ${ABILIST_FILE} $<TARGET_SONAME_FILE:cxx_shared>
|
||||
${SYMDIFF_EXE} --only-stdlib-symbols --strict ${ABILIST_FILE}
|
||||
$<TARGET_SONAME_FILE:cxx_shared>
|
||||
DEPENDS cxx_shared
|
||||
COMMENT "Testing ABI compatibility...")
|
||||
endif()
|
||||
|
@@ -98,4 +98,6 @@ def report_diff(added_syms, removed_syms, changed_syms, names_only=False,
|
||||
report += 'ABI BREAKAGE: SYMBOLS ADDED OR REMOVED!'
|
||||
else:
|
||||
report += 'Symbols match.'
|
||||
return report, int(abi_break)
|
||||
is_different = abi_break or bool(len(added_syms)) \
|
||||
or bool(len(changed_syms))
|
||||
return report, abi_break, is_different
|
||||
|
@@ -30,6 +30,10 @@ def main():
|
||||
parser.add_argument('--only-stdlib-symbols', dest='only_stdlib',
|
||||
help="Filter all symbols not related to the stdlib",
|
||||
action='store_true', default=False)
|
||||
parser.add_argument('--strict', dest='strict',
|
||||
help="Exit with a non-zero status if any symbols "
|
||||
"differ",
|
||||
action='store_true', default=False)
|
||||
parser.add_argument(
|
||||
'-o', '--output', dest='output',
|
||||
help='The output file. stdout is used if not given',
|
||||
@@ -54,16 +58,16 @@ def main():
|
||||
added, removed, changed = diff.diff(old_syms_list, new_syms_list)
|
||||
if args.removed_only:
|
||||
added = {}
|
||||
report, is_break = diff.report_diff(added, removed, changed,
|
||||
names_only=args.names_only,
|
||||
report, is_break, is_different = diff.report_diff(
|
||||
added, removed, changed, names_only=args.names_only,
|
||||
demangle=args.demangle)
|
||||
if args.output is None:
|
||||
print(report)
|
||||
else:
|
||||
with open(args.output, 'w') as f:
|
||||
f.write(report + '\n')
|
||||
sys.exit(is_break)
|
||||
|
||||
exit_code = 1 if is_break or (args.strict and is_different) else 0
|
||||
sys.exit(exit_code)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Reference in New Issue
Block a user