From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH v3 2/2] Start libclang based analyzer and TEST() check
Date: Mon, 14 Jun 2021 15:41:22 +0200 [thread overview]
Message-ID: <YMdcgrabnou+u90I@pevik> (raw)
In-Reply-To: <20210614115638.25467-3-rpalethorpe@suse.com>
Hi Richie,
> +#if HAVE_CLANG_C_INDEX_H
> +
> +#include <clang-c/Index.h>
...
> +static void emit_error(const char *const error_msg)
> +{
> + if (color_enabled(STDERR_FILENO)) {
> + dprintf(STDERR_FILENO,
> + "%sERROR%s: %s%s%s\n",
> + ansi_red, ansi_reset,
> + ansi_bold, error_msg, ansi_reset);
> + } else {
> + dprintf(STDERR_FILENO, "ERROR: %s\n", error_msg);
> + }
> +}
...
> + if (ret != CXError_Success) {
> + emit_error("Failed to parse translation unit!");
> + return 1;
> + }
...
> +#else
> +
> +int main(const attr_unused int argc, const attr_unused char *const *const argv)
> +{
> + emit_error("clang-checks was not built correctly; libclang headers are not installed!\n");
emit_error() is not visible here, thus build fails. Please add it before HAVE_CLANG_C_INDEX_H.
Or you could just use tst_test.h with TST_NO_DEFAULT_MAIN and here would be TST_TEST_TCONF()
(+ LTP_ATTRIBUTE_UNUSED).
Kind regards,
Petr
> + return 1;
> +}
> +
> +#endif
next prev parent reply other threads:[~2021-06-14 13:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-14 11:56 [LTP] [RFC PATCH v3 0/2] Libclang based analyzer Richard Palethorpe
2021-06-14 11:56 ` [LTP] [RFC PATCH v3 1/2] Add 'make check' and clang-check to build system Richard Palethorpe
2021-06-15 14:16 ` Cyril Hrubis
2021-06-14 11:56 ` [LTP] [RFC PATCH v3 2/2] Start libclang based analyzer and TEST() check Richard Palethorpe
2021-06-14 13:41 ` Petr Vorel [this message]
2021-06-14 13:52 ` Petr Vorel
2021-06-14 14:25 ` Richard Palethorpe
2021-06-14 14:27 ` Richard Palethorpe
2021-06-15 10:44 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YMdcgrabnou+u90I@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox