xref: /kernel/linux/linux-5.10/scripts/clang-version.sh (revision 8c2ecf20)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/scripts/
18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
38c2ecf20Sopenharmony_ci#
48c2ecf20Sopenharmony_ci# clang-version clang-command
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci# Print the compiler version of `clang-command' in a 5 or 6-digit form
78c2ecf20Sopenharmony_ci# such as `50001' for clang-5.0.1 etc.
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cicompiler="$*"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciif ! ( $compiler --version | grep -q clang) ; then
128c2ecf20Sopenharmony_ci	echo 0
138c2ecf20Sopenharmony_ci	exit 1
148c2ecf20Sopenharmony_cifi
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciMAJOR=$(echo __clang_major__ | $compiler -E -x c - | tail -n 1)
178c2ecf20Sopenharmony_ciMINOR=$(echo __clang_minor__ | $compiler -E -x c - | tail -n 1)
188c2ecf20Sopenharmony_ciPATCHLEVEL=$(echo __clang_patchlevel__ | $compiler -E -x c - | tail -n 1)
198c2ecf20Sopenharmony_ciprintf "%d%02d%02d\\n" $MAJOR $MINOR $PATCHLEVEL
20

Indexes created Thu Nov 07 10:32:03 CST 2024