All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] scripts: provide a script for checking glib symbol usage
Date: Fri, 18 Dec 2015 13:05:55 +0000	[thread overview]
Message-ID: <20151218130555.GB7228@redhat.com> (raw)
In-Reply-To: <5673FDB0.6040900@redhat.com>

On Fri, Dec 18, 2015 at 01:36:00PM +0100, Paolo Bonzini wrote:
> 
> 
> 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?

Any particular reason to favour that over include ? I did it this
way because QEMU in general seems to be biased towards includes
and not recursive make

> > +# 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.

Yep, that works.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2015-12-18 13:06 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
2015-12-18 13:05   ` Daniel P. Berrange [this message]
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=20151218130555.GB7228@redhat.com \
    --to=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.