Skip to contentSkip to conversation

checkpatch.pl: add common glib defines to typelist

PATCH Superseded Peter Xu 2 participants 3 messages Apr 25, 2018 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Peter Xu

author
#0 lore raw

PATCH 1/1 checkpatch.pl: add common glib defines to typelist

Otherwise it can warn this:

ERROR: space prohibited between function name and open parenthesis '('

When with things like this:

typedef gboolean (*it_tree_iterator)(ITValue start, ITValue end);

CC Paolo Bonzini <[email protected]>
CC Stefan Hajnoczi <[email protected]>
CC "Daniel P. Berrangé" <[email protected]>
CC Markus Armbruster <[email protected]>
CC Vladimir Sementsov-Ogievskiy <[email protected]>
CC Fam Zheng <[email protected]>
---
 scripts/checkpatch.pl | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
scripts/checkpatch.pl +14 -0
index d52207a3cc..6c25449cd3 100755
@@ -266,6 +266,20 @@ our @typeList = (
 	qr{target_(?:u)?long},
 	qr{hwaddr},
 	qr{xml${Ident}},
+	# Glib definitions
+	qr{gchar},
+	qr{gshort},
+	qr{glong},
+	qr{gint},
+	qr{gboolean},
+	qr{guchar},
+	qr{gushort},
+	qr{gulong},
+	qr{guint},
+	qr{gfloat},
+	qr{gdouble},
+	qr{gpointer},
+	qr{gconstpointer},
 );
 
 # This can be modified by sub possible.  Since it can be empty, be careful
Signature · 1 line
2.14.3
#1 lore raw
Quoted 34 lines · Peter Xu

Otherwise it can warn this:

ERROR: space prohibited between function name and open parenthesis '('

When with things like this:

typedef gboolean (*it_tree_iterator)(ITValue start, ITValue end);

CC Paolo Bonzini <[email protected]>
CC Stefan Hajnoczi <[email protected]>
CC "Daniel P. Berrangé" <[email protected]>
CC Markus Armbruster <[email protected]>
CC Vladimir Sementsov-Ogievskiy <[email protected]>
CC Fam Zheng <[email protected]>
---
 scripts/checkpatch.pl | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
scripts/checkpatch.pl +7 -0
index d52207a3cc..6c25449cd3 100755
@@ -266,6 +266,20 @@ our @typeList = (
 	qr{target_(?:u)?long},
 	qr{hwaddr},
 	qr{xml${Ident}},
+	# Glib definitions
+	qr{gchar},
+	qr{gshort},
+	qr{glong},
+	qr{gint},
+	qr{gboolean},
+	qr{guchar},

scripts/checkpatch.pl our @typeList = ( · line 285

Quoted 10 lines
scripts/checkpatch.pl +7 -0
+	qr{gushort},
+	qr{gulong},
+	qr{guint},
+	qr{gfloat},
+	qr{gdouble},
+	qr{gpointer},
+	qr{gconstpointer},
 );
 
 # This can be modified by sub possible.  Since it can be empty, be careful

Personally, I'd kill these with fire, then salt the fields that bore them.

But as long as we have them in our code, checkpatch needs to cope. Let's list all types documented in
<https://developer.gnome.org/glib/stable/glib-Basic-Types.html>.
Missing:

    gint8
    guint8
    gint16
    guint16
    gint32
    guint32
    gint64
    guint64
    gsize
    gssize
    goffset
    gintptr
    guintptr
author
#2 lore raw
Quoted 55 lines · Markus Armbruster
Quoted 34 lines · Peter Xu

Otherwise it can warn this:

ERROR: space prohibited between function name and open parenthesis '('

When with things like this:

typedef gboolean (*it_tree_iterator)(ITValue start, ITValue end);

CC Paolo Bonzini <[email protected]>
CC Stefan Hajnoczi <[email protected]>
CC "Daniel P. Berrangé" <[email protected]>
CC Markus Armbruster <[email protected]>
CC Vladimir Sementsov-Ogievskiy <[email protected]>
CC Fam Zheng <[email protected]>
---
 scripts/checkpatch.pl | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
scripts/checkpatch.pl +7 -0
index d52207a3cc..6c25449cd3 100755
@@ -266,6 +266,20 @@ our @typeList = (
 	qr{target_(?:u)?long},
 	qr{hwaddr},
 	qr{xml${Ident}},
+	# Glib definitions
+	qr{gchar},
+	qr{gshort},
+	qr{glong},
+	qr{gint},
+	qr{gboolean},
+	qr{guchar},

scripts/checkpatch.pl our @typeList = ( · line 285

Quoted 10 lines
scripts/checkpatch.pl +7 -0
+	qr{gushort},
+	qr{gulong},
+	qr{guint},
+	qr{gfloat},
+	qr{gdouble},
+	qr{gpointer},
+	qr{gconstpointer},
 );
 
 # This can be modified by sub possible.  Since it can be empty, be careful

Personally, I'd kill these with fire, then salt the fields that bore them.

But as long as we have them in our code, checkpatch needs to cope. Let's list all types documented in
<https://developer.gnome.org/glib/stable/glib-Basic-Types.html>.
Missing:

Quoted 13 lines
    gint8
    guint8
    gint16
    guint16
    gint32
    guint32
    gint64
    guint64
    gsize
    gssize
    goffset
    gintptr
    guintptr

I got the old list from the header file (glib/gtypes.h) directly, so I should go for the document next time! It's strange that I can hardly find where is, e.g. gint8, defined. Anyway, I'm posting a new one.

Thanks!

Signature · 1 line
Peter Xu