From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH] scripts: provide a script for checking glib symbol usage
Date: Fri, 18 Dec 2015 13:36:00 +0100 [thread overview]
Message-ID: <5673FDB0.6040900@redhat.com> (raw)
In-Reply-To: <1450438575-21613-1-git-send-email-berrange@redhat.com>
On 18/12/2015 12:36, Daniel P. Berrange wrote:
> diff --git a/scripts/Makefile b/scripts/Makefile
> new file mode 100644
> index 0000000..162e7e9
> --- /dev/null
> +++ b/scripts/Makefile
> @@ -0,0 +1,24 @@
> +#
> +# This makefile runs various style checks across the entire
> +# source tree.
> +#
> +# This is similar in concept of checkpatch.pl, but enforces
> +# rules across the entire codebase, not just new patches
> +#
> +
> +STYLE_CHECKS = \
> + cs-glib-syms
> +
> +ALL_FILES = \
> + $(shell git ls-tree -r HEAD . | awk '{print $$4}')
> +
> +C_CODE_FILES = $(filter %.c %.h, $(ALL_FILES))
> +
> +check-style: $(STYLE_CHECKS)
> +
> +# Check that we only use glib symbols present in our
> +# minimum declared glib version
> +GLIB_SYMS_LIST = scripts/glib-syms.txt
> +
> +cs-glib-syms:
> + @perl scripts/glib-syms.pl $(GLIB_SYMS_LIST) $(C_CODE_FILES)
Does this need to be included, or could it be a separate Makefile
invoked with e.g. make -f scripts/Makefile.style?
> +# Symbols not present in the release that we depend
> +# on, but which have wrappers in include/glib-compat.h
> +my @compatsyms = qw(
> + g_get_monotonic_time
> +
> + g_assert_true
> + g_assert_false
> + g_assert_null
> + g_assert_nonnull
> + g_assert_cmpmem
> +
> + g_hash_table_add
> +
> + g_cond_clear
> + g_cond_init
> + g_cond_wait_until
> +
> + g_mutex_init
> + g_mutex_clear
> +
> + g_thread_new
> +
> + g_private_replace
> + G_PRIVATE_INIT
> +
> + G_TIME_SPAN_SECOND
> +);
> +
> +
> +# Functions defined inside QEMU which are using the
> +# the same "g_" function name prefix as glib, so
> +# get mis-detected as glib symbols
> +my @blacklist = qw(
> + g_to_float64
> + g_assert_no_errno
> + g_cclosure_new_swap
> + g_free_rcu
> + g_test_trap_subprocess
> + g_poll_fixed
> + g_list_insert_sorted_merged
> + G_BYTE
> +);
> +
> +# GObject stuff used by gtk frontend
> +my @gobjectsums = qw(
> + g_object_ref
> + g_object_unref
> + g_object_set_data
> + g_signal_connect
> + G_CALLBACK
> +);
> +
> +# Functions defined by glib which are strangely
> +# missing from their docs header index
> +my @missingindex = qw(
> + g_assertion_message
> + g_assertion_message_expr
> + g_assertion_message_cmpstr
> + g_assertion_message_cmpnum
> + g_assertion_message_error
> +);
> +
Can we "parse" #.* as comments, and put these in a glib-syms-extra.txt
file? Then we can hypothetically do the same tests in checkpatch.pl too.
I'm not opposing the scripts/Makefile concept, and I'm not asking you to
patch checkpatch.pl; I just would like to keep the door open for that.
Paolo
next prev parent reply other threads:[~2015-12-18 12:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-18 11:36 [Qemu-devel] [PATCH] scripts: provide a script for checking glib symbol usage Daniel P. Berrange
2015-12-18 12:36 ` Paolo Bonzini [this message]
2015-12-18 13:05 ` Daniel P. Berrange
2015-12-18 13:08 ` Paolo Bonzini
2015-12-18 13:35 ` Dr. David Alan Gilbert
2015-12-18 13:37 ` Daniel P. Berrange
2015-12-18 13:42 ` Dr. David Alan Gilbert
2015-12-18 13:49 ` Peter Maydell
2015-12-18 13:52 ` Dr. David Alan Gilbert
2015-12-18 13:41 ` Paolo Bonzini
2015-12-18 13:43 ` Peter Maydell
2015-12-18 14:49 ` Daniel P. Berrange
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=5673FDB0.6040900@redhat.com \
--to=pbonzini@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).