libxcb: Changes to 'upstream'
Rebased ref, commits from common ancestor:
commit 7cf5ac145b7b1858ea8d3df178c99c5b00750d37
Author: Uli Schlachter <psychon@znc.in>
Date: Sun Sep 6 12:39:19 2015 +0200
Release libxcb 1.11.1
diff --git a/NEWS b/NEWS
index 00285c2..aee79ed 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+Release 1.11.1 (2015-09-06)
+===========================
+* Expose 64-bit sequence numbers for XLib
+* Fix some hangs related to xcb_wait_for_special_event()
+
Release 1.11 (2014-08-01)
=========================
* Force structures with 64-bit fields to be packed
diff --git a/configure.ac b/configure.ac
index eb4a971..8a14a96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libxcb],[1.11],
+AC_INIT([libxcb],[1.11.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xcb],
[libxcb])
AC_CONFIG_AUX_DIR([build-aux])
commit 00903d4d6a32d498bd5d1eb8b7b733b133bc9692
Author: Uli Schlachter <psychon@znc.in>
Date: Fri Jun 12 15:13:05 2015 +0200
Fix a thread hang with xcb_wait_for_special_event()
Consider the following:
- Two threads are calling xcb_wait_for_special_event() and xcb_wait_for_reply()
concurrently.
- The thread doing xcb_wait_for_reply() wins the race and poll()s the socket for
readability.
- The other thread will be put to sleep on the special_event_cond of the special
event (this is done in _xcb_conn_wait() via the argument
xcb_wait_for_special_event() gives it).
- The first thread gets its reply, but does not yet receive any special event.
In this case, the first thread will return to its caller. On its way out, it
will call _xcb_in_wake_up_next_reader(), but that function cannot wake up
anything since so far it did not handle xcb_wait_for_special_event().
Thus, the first thread stays blocked on the condition variable and no thread
tries to read from the socket.
A test case demonstrating this problem is available at the bug report.
Fix this similar to how we handle this with xcb_wait_for_reply():
The function wait_for_reply() adds an entry into a linked list of threads that
wait for a reply. Via this list, _xcb_in_wake_up_next_reader() can wake up this
thread so that it can call _xcb_conn_wait() again and then poll()s the socket.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84252
Signed-off-by: Uli Schlachter <psychon@znc.in>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
diff --git a/src/xcb_in.c b/src/xcb_in.c
index 322bed8..bab4bc7 100644
--- a/src/xcb_in.c
+++ b/src/xcb_in.c
@@ -97,6 +97,11 @@ typedef struct reader_list {
struct reader_list *next;
} reader_list;
+typedef struct special_list {
+ xcb_special_event_t *se;
+ struct special_list *next;
+} special_list;
+
static void remove_finished_readers(reader_list **prev_reader, uint64_t completed)
{
while(*prev_reader && XCB_SEQUENCE_COMPARE((*prev_reader)->request, <=, completed))
@@ -475,6 +480,26 @@ static void remove_reader(reader_list **prev_reader, reader_list *reader)
}
}
+static void insert_special(special_list **prev_special, special_list *special, xcb_special_event_t *se)
+{
+ special->se = se;
+ special->next = *prev_special;
+ *prev_special = special;
+}
+
+static void remove_special(special_list **prev_special, special_list *special)
+{
+ while(*prev_special)
+ {
+ if(*prev_special == special)
+ {
+ *prev_special = (*prev_special)->next;
+ break;
+ }
+ prev_special = &(*prev_special)->next;
+ }
+}
+
static void *wait_for_reply(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e)
{
void *ret = 0;
@@ -750,17 +775,22 @@ xcb_generic_event_t *xcb_poll_for_special_event(xcb_connection_t *c,
xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
xcb_special_event_t *se)
{
+ special_list special;
xcb_generic_event_t *event;
if(c->has_error)
return 0;
pthread_mutex_lock(&c->iolock);
+ insert_special(&c->in.special_waiters, &special, se);
+
/* get_special_event returns 0 on empty list. */
while(!(event = get_special_event(c, se)))
if(!_xcb_conn_wait(c, &se->special_event_cond, 0, 0))
break;
+ remove_special(&c->in.special_waiters, &special);
+
_xcb_in_wake_up_next_reader(c);
pthread_mutex_unlock(&c->iolock);
return event;
@@ -889,6 +919,8 @@ void _xcb_in_wake_up_next_reader(xcb_connection_t *c)
int pthreadret;
if(c->in.readers)
pthreadret = pthread_cond_signal(c->in.readers->data);
+ else if(c->in.special_waiters)
+ pthreadret = pthread_cond_signal(&c->in.special_waiters->se->special_event_cond);
else
pthreadret = pthread_cond_signal(&c->in.event_cond);
assert(pthreadret == 0);
diff --git a/src/xcbint.h b/src/xcbint.h
index f89deba..acce646 100644
--- a/src/xcbint.h
+++ b/src/xcbint.h
@@ -142,6 +142,7 @@ typedef struct _xcb_in {
struct event_list *events;
struct event_list **events_tail;
struct reader_list *readers;
+ struct special_list *special_waiters;
struct pending_reply *pending_replies;
struct pending_reply **pending_replies_tail;
commit a31c295870f2812cb2ce4cff351e2c0a3b144661
Author: Michel Dänzer <michel.daenzer@amd.com>
Date: Mon Jun 1 11:04:18 2015 +0900
Call _xcb_wake_up_next_reader from xcb_wait_for_special_event
All functions calling _xcb_conn_wait() must make sure that waiting
readers are woken up when we read a reply or event that they are waiting
for. xcb_wait_for_special_event() did not do so. This adds the missing
call to_xcb_in_wake_up_next_reader().
Fixes deadlock when waiting for a special event and concurrently
processing the display connection queue in another thread.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84252
Tested-by: Thomas Daede <bztdlinux@gmail.com>
Tested-by: Clément Guérin <geecko.dev@free.fr>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Michel Dänzer <michel@daenzer.net>
Signed-off-by: Uli Schlachter <psychon@znc.in>
diff --git a/src/xcb_in.c b/src/xcb_in.c
index 623a0a8..322bed8 100644
--- a/src/xcb_in.c
+++ b/src/xcb_in.c
@@ -761,6 +761,7 @@ xcb_generic_event_t *xcb_wait_for_special_event(xcb_connection_t *c,
if(!_xcb_conn_wait(c, &se->special_event_cond, 0, 0))
break;
+ _xcb_in_wake_up_next_reader(c);
pthread_mutex_unlock(&c->iolock);
return event;
}
commit 0ba6fe9b4eaa70383cd2ee066dfb3f1e67efeb83
Author: Christian Linhart <chris@demorecorder.com>
Date: Wed Apr 29 09:11:37 2015 +0200
expose 64-bit sequence numbers for XLib
While XCB uses 64-bit sequence number internally, it only exposes
"unsigned int" so that, on 32-bit architecture, Xlib based applications
may see their sequence number wrap which causes the connection to the X
server to be lost.
Expose 64-bit sequence number from XCB API so that Xlib and others can
use it even on 32-bit environment.
This implies the following API addition:
xcb_send_request64()
xcb_discard_reply64()
xcb_wait_for_reply64()
xcb_poll_for_reply64()
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71338
Reviewed-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Christian Linhart <chris@demorecorder.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
diff --git a/src/xcb.h b/src/xcb.h
index 23fe74e..86eb1bc 100644
--- a/src/xcb.h
+++ b/src/xcb.h
@@ -378,6 +378,26 @@ xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t co
*/
void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
+/**
+ * @brief Discards the reply for a request, given by a 64bit sequence number
+ * @param c: The connection to the X server.
+ * @param sequence: 64-bit sequence number as returned by xcb_send_request64().
+ *
+ * Discards the reply for a request. Additionally, any error generated
+ * by the request is also discarded (unless it was an _unchecked request
+ * and the error has already arrived).
+ *
+ * This function will not block even if the reply is not yet available.
+ *
+ * Note that the sequence really does have to come from xcb_send_request64();
+ * the cookie sequence number is defined as "unsigned" int and therefore
+ * not 64-bit on all platforms.
+ * This function is not designed to operate on socket-handoff replies.
+ *
+ * Unlike its xcb_discard_reply() counterpart, the given sequence number is not
+ * automatically "widened" to 64-bit.
+ */
+void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence);
/* xcb_ext.c */
diff --git a/src/xcb_in.c b/src/xcb_in.c
index ad870c1..623a0a8 100644
--- a/src/xcb_in.c
+++ b/src/xcb_in.c
@@ -523,6 +523,20 @@ void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_
return ret;
}
+void *xcb_wait_for_reply64(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e)
+{
+ void *ret;
+ if(e)
+ *e = 0;
+ if(c->has_error)
+ return 0;
+
+ pthread_mutex_lock(&c->iolock);
+ ret = wait_for_reply(c, request, e);
+ pthread_mutex_unlock(&c->iolock);
+ return ret;
+}
+
int *xcb_get_reply_fds(xcb_connection_t *c, void *reply, size_t reply_size)
{
return (int *) (&((char *) reply)[reply_size]);
@@ -595,6 +609,20 @@ void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence)
pthread_mutex_unlock(&c->iolock);
}
+void xcb_discard_reply64(xcb_connection_t *c, uint64_t sequence)
+{
+ if(c->has_error)
+ return;
+
+ /* If an error occurred when issuing the request, fail immediately. */
+ if(!sequence)
+ return;
+
+ pthread_mutex_lock(&c->iolock);
+ discard_reply(c, sequence);
+ pthread_mutex_unlock(&c->iolock);
+}
+
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error)
{
int ret;
@@ -612,6 +640,23 @@ int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply,
return ret;
}
+int xcb_poll_for_reply64(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error)
+{
+ int ret;
+ if(c->has_error)
+ {
+ *reply = 0;
+ if(error)
+ *error = 0;
+ return 1; /* would not block */
+ }
+ assert(reply != 0);
+ pthread_mutex_lock(&c->iolock);
+ ret = poll_for_reply(c, request, reply, error);
+ pthread_mutex_unlock(&c->iolock);
+ return ret;
+}
+
xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c)
{
xcb_generic_event_t *ret;
diff --git a/src/xcb_out.c b/src/xcb_out.c
index dc42954..8cc5be8 100644
--- a/src/xcb_out.c
+++ b/src/xcb_out.c
@@ -177,7 +177,7 @@ uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
return c->out.maximum_request_length.value;
}
-unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
+uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
{
uint64_t request;
uint32_t prefix[2];
@@ -286,6 +286,12 @@ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vect
return request;
}
+/* request number are actually uint64_t internally but keep API compat with unsigned int */
+unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
+{
+ return xcb_send_request64(c, flags, vector, req);
+}
+
void
xcb_send_fd(xcb_connection_t *c, int fd)
{
diff --git a/src/xcbext.h b/src/xcbext.h
index 7587513..b2575f7 100644
--- a/src/xcbext.h
+++ b/src/xcbext.h
@@ -83,6 +83,30 @@ enum xcb_send_request_flags_t {
unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
/**
+ * @brief Send a request to the server, with 64-bit sequence number returned.
+ * @param c: The connection to the X server.
+ * @param flags: A combination of flags from the xcb_send_request_flags_t enumeration.
+ * @param vector: Data to send; must have two iovecs before start for internal use.
+ * @param request: Information about the request to be sent.
+ * @return The request's sequence number on success, 0 otherwise.
+ *
+ * This function sends a new request to the X server. The data of the request is
+ * given as an array of @c iovecs in the @p vector argument. The length of that
+ * array and the neccessary management information are given in the @p request
+ * argument.
+ *
+ * When this function returns, the request might or might not be sent already.
+ * Use xcb_flush() to make sure that it really was sent.
+ *
+ * Please note that this function is not the prefered way for sending requests.
+ * It's better to use the generated wrapper functions.
+ *
+ * Please note that xcb might use index -1 and -2 of the @p vector array internally,
+ * so they must be valid!
+ */
+uint64_t xcb_send_request64(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
+
+/**
* @brief Send a file descriptor to the server in the next call to xcb_send_request.
* @param c: The connection to the X server.
* @param fd: The file descriptor to send.
@@ -162,6 +186,21 @@ int xcb_writev(xcb_connection_t *c, struct iovec *vector, int count, uint64_t re
void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
/**
+ * @brief Wait for the reply of a given request, with 64-bit sequence number
+ * @param c: The connection to the X server.
+ * @param request: 64-bit sequence number of the request as returned by xcb_send_request64().
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ *
+ * Returns the reply to the given request or returns null in the event of
+ * errors. Blocks until the reply or error for the request arrives, or an I/O
+ * error occurs.
+ *
+ * Unlike its xcb_wait_for_reply() counterpart, the given sequence number is not
+ * automatically "widened" to 64-bit.
+ */
+void *xcb_wait_for_reply64(xcb_connection_t *c, uint64_t request, xcb_generic_error_t **e);
+
+/**
* @brief Poll for the reply of a given request.
* @param c: The connection to the X server.
* @param request: Sequence number of the request as returned by xcb_send_request().
@@ -174,6 +213,21 @@ void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_
int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
/**
+ * @brief Poll for the reply of a given request, with 64-bit sequence number.
+ * @param c: The connection to the X server.
+ * @param request: 64-bit sequence number of the request as returned by xcb_send_request().
+ * @param reply: Location to store the reply in, must not be NULL.
+ * @param e: Location to store errors in, or NULL. Ignored for unchecked requests.
+ * @return 1 when the reply to the request was returned, else 0.
+ *
+ * Checks if the reply to the given request already received. Does not block.
+ *
+ * Unlike its xcb_poll_for_reply() counterpart, the given sequence number is not
+ * automatically "widened" to 64-bit.
+ */
+int xcb_poll_for_reply64(xcb_connection_t *c, uint64_t request, void **reply, xcb_generic_error_t **error);
+
+/**
* @brief Don't use this, only needed by the generated code.
* @param c: The connection to the X server.
* @param reply: A reply that was received from the server
commit d1e8ec96fca4862f37ec9f0e9407bb989c4c161a
Author: Uli Schlachter <psychon@znc.in>
Date: Fri Aug 1 15:56:52 2014 +0200
Release libxcb 1.11
diff --git a/NEWS b/NEWS
index 0152bcb..00285c2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Release 1.11 (2014-08-01)
+=========================
+* Force structures with 64-bit fields to be packed
+* Add support for <pad align="n">
+* Use X.org's build machinery from xorg-macros
+* Fix leak with xcb_disconnect() and connections in an error state
+* Make xcb_disconnect(NULL) safe
+* Use less #include statements in generated code
+* Automatically validate the Requires lines in our .pc.in files
+* Fix a race that resulted in a failed assertion
+* Improve launchd secure socket support
+* Improve API documentation
+* Remove trailing whitespaces
+* c_client.py: prefix all monkey-patched fields with c_
+* c_client.py: make the man page output deterministic
+* c_client.py: remove useless generated comments
+* xcb.h: add 'struct' before xcb_setup_t, xcb_query_extension_reply_t
+
Release 1.10 (2013-12-22)
=========================
* Bump libxcb-xkb SONAME due to ABI break introduced in 1.9.2
diff --git a/configure.ac b/configure.ac
index 4aba894..eb4a971 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
# Initialize Autoconf
AC_PREREQ([2.60])
-AC_INIT([libxcb],[1.10],
+AC_INIT([libxcb],[1.11],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xcb],
[libxcb])
AC_CONFIG_AUX_DIR([build-aux])
commit c5c6cfa4d2a27d0f9e139a1856d866433b6046bc
Author: Uli Schlachter <psychon@znc.in>
Date: Fri Aug 1 16:03:24 2014 +0200
Bump xcb-proto requirement to 1.11
This is needed for the new direct_imports field that we need from xcb-proto.
Signed-off-by: Uli Schlachter <psychon@znc.in>
diff --git a/configure.ac b/configure.ac
index 68c3b2f..4aba894 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ fi
AC_SUBST(HTML_CHECK_RESULT)
# Checks for pkg-config packages
-PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.10)
+PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 1.11)
NEEDED="pthread-stubs xau >= 0.99.2"
PKG_CHECK_MODULES(NEEDED, $NEEDED)
commit 70ea5da64b34336bb0916f6c325545cb50746159
Author: Alexander Mezin <mezin.alexander@gmail.com>
Date: Sun Jun 29 17:33:48 2014 +0700
xcb.h: add 'struct' before xcb_setup_t, xcb_query_extension_reply_t
These structs are typedef'ed in xproto.h, so in xcb.h these types
(without 'struct') are actually undefined.
GCC reports this as error when building precompiled header.
Signed-off-by: Alexander Mezin <mezin.alexander@gmail.com>
Reviewed-by: Peter Harris <pharris@opentext.com>
diff --git a/src/xcb.h b/src/xcb.h
index 0bf59d0..23fe74e 100644
--- a/src/xcb.h
+++ b/src/xcb.h
@@ -397,7 +397,7 @@ void xcb_discard_reply(xcb_connection_t *c, unsigned int sequence);
* The result must not be freed. This storage is managed by the cache
* itself.
*/
-const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
+const struct xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
/**
* @brief Prefetch of extension data into the extension cache
@@ -433,7 +433,7 @@ void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
*
* The result must not be freed.
*/
-const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
+const struct xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
/**
* @brief Access the file descriptor of the connection.
commit 7e6af51b4e984f661fe4f21596cab5cb8ee15ea0
Author: Ran Benita <ran234@gmail.com>
Date: Tue Feb 25 14:11:35 2014 +0200
c_client.py: remove more trailing space from generated files
Signed-off-by: Ran Benita <ran234@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
diff --git a/src/c_client.py b/src/c_client.py
index 3c3bbc0..54e56c4 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1969,7 +1969,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
_c(' /* opcode */ %s,', self.c_request_name.upper())
_c(' /* isvoid */ %d', 1 if void else 0)
_c(' };')
- _c(' ')
+ _c('')
_c(' struct iovec xcb_parts[%d];', dimension)
_c(' %s xcb_ret;', func_cookie)
@@ -1986,7 +1986,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
_c(' unsigned int i;')
_c(' unsigned int xcb_tmp_len;')
_c(' char *xcb_tmp;')
- _c(' ')
+ _c('')
# simple request call tracing
# _c(' printf("in function %s\\n");' % func_name)
@@ -2015,7 +2015,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
# calls in order to free dyn. all. memory
free_calls = []
- _c(' ')
+ _c('')
if not self.c_var_followed_by_fixed_fields:
_c(' xcb_parts[2].iov_base = (char *) &xcb_out;')
_c(' xcb_parts[2].iov_len = sizeof(xcb_out);')
@@ -2056,7 +2056,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
idx = serial_fields.index(field)
aux_var = '&xcb_aux%d' % idx
context = 'serialize' if aux else 'sizeof'
- _c(' xcb_parts[%d].iov_len = ', count)
+ _c(' xcb_parts[%d].iov_len =', count)
if aux:
serialize_args = get_serialize_args(field.type, aux_var, field.c_field_name, context)
_c(' %s (%s);', field.type.c_serialize_name, serialize_args)
@@ -2088,7 +2088,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
free_calls.append(' free(xcb_aux);')
# no padding necessary - _serialize() keeps track of padding automatically
- _c(' ')
+ _c('')
for field in param_fields:
if field.isfd:
_c(' xcb_send_fd(c, %s);', field.c_field_name)
commit 8221d249b77131b338e3b35ce2229193f129e514
Author: Ran Benita <ran234@gmail.com>
Date: Sun Feb 23 22:55:21 2014 +0200
c_client.py: remove trailing whitespace from generated files
Signed-off-by: Ran Benita <ran234@gmail.com>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
diff --git a/src/c_client.py b/src/c_client.py
index ee5bdf9..3c3bbc0 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -202,7 +202,7 @@ def c_open(self):
_h('')
_h('#define XCB_%s_MAJOR_VERSION %s', _ns.ext_name.upper(), _ns.major_version)
_h('#define XCB_%s_MINOR_VERSION %s', _ns.ext_name.upper(), _ns.minor_version)
- _h(' ') #XXX
+ _h('') #XXX
_h('extern xcb_extension_t %s;', _ns.c_ext_global_name)
_c('')
@@ -1916,7 +1916,7 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
_h(' * No description yet')
else:
_h(' * Delivers a request to the X server.')
- _h(' * ')
+ _h(' *')
if checked:
_h(' * This form can be used only if the request will not cause')
_h(' * a reply to be generated. Any returned error will be')
@@ -2139,7 +2139,7 @@ def _c_reply(self, name):
_h(' * @param e The xcb_generic_error_t supplied')
_h(' *')
_h(' * Returns the reply of the request asked by')
- _h(' * ')
+ _h(' *')
_h(' * The parameter @p e supplied to this function must be NULL if')
_h(' * %s(). is used.', self.c_unchecked_name)
_h(' * Otherwise, it stores the error if any.')
@@ -2203,7 +2203,7 @@ def _c_reply_fds(self, name):
_h(' * @param reply The reply')
_h(' *')
_h(' * Returns the array of reply fds of the request asked by')
- _h(' * ')
+ _h(' *')
_h(' * The returned value must be freed by the caller using free().')
_h(' */')
_c('')
commit e3c728ee3d9a2fd7478d5f57830c3483b774a16e
Author: Ran Benita <ran234@gmail.com>
Date: Sun Feb 23 22:55:20 2014 +0200
c_client.py: remove useless generated comments
They are bloated, don't add anything over the signature, in some cases
duplicate the doxygen comments, and are not integrated with the <doc>
tags in any way. Remove them and cut the generated LOC by half.
Signed-off-by: Ran Benita <ran234@gmail.com>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
diff --git a/src/c_client.py b/src/c_client.py
index df2ed11..ee5bdf9 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1320,16 +1320,6 @@ def _c_iterator(self, name):
_h(' * element. The member index is increased by sizeof(%s)', self.c_type)
_h(' */')
_c('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** void %s', self.c_next_name)
- _hc(' ** ')
- _hc(' ** @param %s *i', self.c_iterator_type)
- _hc(' ** @returns void')
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('void')
_h('%s (%s *i /**< */);', self.c_next_name, self.c_iterator_type)
_c('%s (%s *i /**< */)', self.c_next_name, self.c_iterator_type)
@@ -1371,16 +1361,6 @@ def _c_iterator(self, name):
_h(' * last element.')
_h(' */')
_c('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** xcb_generic_iterator_t %s', self.c_end_name)
- _hc(' ** ')
- _hc(' ** @param %s i', self.c_iterator_type)
- _hc(' ** @returns xcb_generic_iterator_t')
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('xcb_generic_iterator_t')
_h('%s (%s i /**< */);', self.c_end_name, self.c_iterator_type)
_c('%s (%s i /**< */)', self.c_end_name, self.c_iterator_type)
@@ -1488,16 +1468,6 @@ def _c_accessors_field(self, field):
if field.type.is_simple:
_hc('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' ** ')
- _hc(' ** %s %s', field.c_field_type, field.c_accessor_name)
- _hc(' ** ')
- _hc(' ** @param const %s *R', c_type)
- _hc(' ** @returns %s', field.c_field_type)
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('%s', field.c_field_type)
_h('%s (const %s *R /**< */);', field.c_accessor_name, c_type)
_c('%s (const %s *R /**< */)', field.c_accessor_name, c_type)
@@ -1511,16 +1481,6 @@ def _c_accessors_field(self, field):
_c('}')
else:
_hc('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** %s * %s', field.c_field_type, field.c_accessor_name)
- _hc(' ** ')
- _hc(' ** @param const %s *R', c_type)
- _hc(' ** @returns %s *', field.c_field_type)
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
if field.type.is_switch and switch_obj is None:
return_type = 'void *'
else:
@@ -1613,16 +1573,6 @@ def _c_accessors_list(self, field):
if list.member.fixed_size():
idx = 1 if switch_obj is not None else 0
_hc('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** %s * %s', field.c_field_type, field.c_accessor_name)
- _hc(' ** ')
- _hc(' ** @param %s', params[idx][0])
- _hc(' ** @returns %s *', field.c_field_type)
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('%s *', field.c_field_type)
_h('%s (%s /**< */);', field.c_accessor_name, params[idx][0])
@@ -1647,16 +1597,6 @@ def _c_accessors_list(self, field):
_c('}')
_hc('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** int %s', field.c_length_name)
- _hc(' ** ')
- _hc(' ** @param const %s *R', c_type)
- _hc(' ** @returns int')
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('int')
if switch_obj is not None:
_hc('%s (const %s *R /**< */,', field.c_length_name, R_obj.c_type)
@@ -1674,16 +1614,6 @@ def _c_accessors_list(self, field):
if field.type.member.is_simple:
_hc('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** xcb_generic_iterator_t %s', field.c_end_name)
- _hc(' ** ')
- _hc(' ** @param const %s *R', c_type)
- _hc(' ** @returns xcb_generic_iterator_t')
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('xcb_generic_iterator_t')
if switch_obj is not None:
_hc('%s (const %s *R /**< */,', field.c_end_name, R_obj.c_type)
@@ -1716,17 +1646,6 @@ def _c_accessors_list(self, field):
else:
_hc('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** %s %s', field.c_iterator_type, field.c_iterator_name)
- _hc(' ** ')
- _hc(' ** @param const %s *R', c_type)
- _hc(' ** @returns %s', field.c_iterator_type)
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
-
_hc('%s', field.c_iterator_type)
if switch_obj is not None:
_hc('%s (const %s *R /**< */,', field.c_iterator_name, R_obj.c_type)
@@ -2008,26 +1927,6 @@ def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
_h(' * placed in the event queue.')
_h(' */')
_c('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** %s %s', cookie_type, func_name)
- _hc(' ** ')
-
- spacing = ' ' * (maxtypelen - len('xcb_connection_t'))
- _hc(' ** @param xcb_connection_t%s *c', spacing)
-
- for field in param_fields:
- c_field_const_type = field.c_field_const_type
- if field.type.c_need_serialize and not aux:
- c_field_const_type = "const void"
- spacing = ' ' * (maxtypelen - len(c_field_const_type))
- _hc(' ** @param %s%s %s%s', c_field_const_type, spacing, field.c_pointer, field.c_field_name)
-
- _hc(' ** @returns %s', cookie_type)
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('%s', cookie_type)
spacing = ' ' * (maxtypelen - len('xcb_connection_t'))
@@ -2248,18 +2147,6 @@ def _c_reply(self, name):
_h(' * The returned value must be freed by the caller using free().')
_h(' */')
_c('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** %s * %s', self.c_reply_type, self.c_reply_name)
- _hc(' ** ')
- _hc(' ** @param xcb_connection_t%s *c', spacing1)
- _hc(' ** @param %s cookie', self.c_cookie_type)
- _hc(' ** @param xcb_generic_error_t%s **e', spacing2)
- _hc(' ** @returns %s *', self.c_reply_type)
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('%s *', self.c_reply_type)
_hc('%s (xcb_connection_t%s *c /**< */,', self.c_reply_name, spacing1)
_hc('%s%s cookie /**< */,', spacing3, self.c_cookie_type)
@@ -2320,17 +2207,6 @@ def _c_reply_fds(self, name):
_h(' * The returned value must be freed by the caller using free().')
_h(' */')
_c('')
- _hc('')
- _hc('/*****************************************************************************')
- _hc(' **')
- _hc(' ** int * %s', self.c_reply_fds_name)
- _hc(' ** ')
- _hc(' ** @param xcb_connection_t%s *c', spacing1)
- _hc(' ** @param %s *reply', self.c_reply_type)
- _hc(' ** @returns int *')
- _hc(' **')
- _hc(' *****************************************************************************/')
- _hc(' ')
_hc('int *')
_hc('%s (xcb_connection_t%s *c /**< */,', self.c_reply_fds_name, spacing1)
_h('%s%s *reply /**< */);', spacing3, self.c_reply_type)
commit cae2e398563841c5b814596fd1f1c64354dcac71
Author: Ran Benita <ran234@gmail.com>
Date: Sun Feb 23 22:55:19 2014 +0200
c_client.py: make the man page output deterministic
Some parts of the man pages (SEE ALSO and ERRORS) are generated by
iterating a Python dict. But the iteration order in a dict is random,
so each build the output is ordered differently. Avoid that by iterating
in sorted order.
Signed-off-by: Ran Benita <ran234@gmail.com>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
diff --git a/src/c_client.py b/src/c_client.py
index 43eb113..df2ed11 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -2716,7 +2716,7 @@ def _man_request(self, name, cookie_type, void, aux):
(cookie_type, self.c_reply_name, base_func_name, section))
f.write('.SH ERRORS\n')
if hasattr(self, "doc") and self.doc:
- for errtype, errtext in self.doc.errors.items():
+ for errtype, errtext in sorted(self.doc.errors.items()):
f.write('.IP \\fI%s\\fP 1i\n' % (_t(('xcb', errtype, 'error'))))
errtext = re.sub(r'`([^`]+)`', r'\\fI\1\\fP', errtext)
f.write('%s\n' % (errtext))
@@ -2734,7 +2734,7 @@ def _man_request(self, name, cookie_type, void, aux):
see = ['.BR %s (%s)' % ('xcb-requests', section)]
if self.doc.example:
see.append('.BR %s (%s)' % ('xcb-examples', section))
- for seename, seetype in self.doc.see.items():
+ for seename, seetype in sorted(self.doc.see.items()):
if seetype == 'program':
see.append('.BR %s (1)' % seename)
elif seetype == 'event':
@@ -2864,7 +2864,7 @@ def _man_event(self, name):
see = ['.BR %s (%s)' % ('xcb_generic_event_t', section)]
if self.doc.example:
see.append('.BR %s (%s)' % ('xcb-examples', section))
- for seename, seetype in self.doc.see.items():
+ for seename, seetype in sorted(self.doc.see.items()):
if seetype == 'program':
see.append('.BR %s (1)' % seename)
elif seetype == 'event':
commit bfbf83b1d8113ac398b57c2738706792946d1c03
Author: Ran Benita <ran234@gmail.com>
Date: Sun Feb 23 22:55:18 2014 +0200
c_client.py: prefix all monkey-patched fields with c_
The script adds many fields to the objects coming from xcbgen. To
distinguish them, a c_ prefix is used, but for some it was missing.
Signed-off-by: Ran Benita <ran234@gmail.com>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
diff --git a/src/c_client.py b/src/c_client.py
index 369ee9d..43eb113 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -305,9 +305,9 @@ def _c_type_setup(self, name, postfix):
self.c_cookie_type = _t(name + ('cookie',))
self.c_reply_fds_name = _n(name + ('reply_fds',))
- self.need_aux = False
- self.need_serialize = False
- self.need_sizeof = False
+ self.c_need_aux = False
+ self.c_need_serialize = False
+ self.c_need_sizeof = False
self.c_aux_name = _n(name + ('aux',))
self.c_aux_checked_name = _n(name + ('aux', 'checked'))
@@ -318,10 +318,10 @@ def _c_type_setup(self, name, postfix):
self.c_sizeof_name = _n(name + ('sizeof',))
# special case: structs where variable size fields are followed by fixed size fields
- self.var_followed_by_fixed_fields = False
+ self.c_var_followed_by_fixed_fields = False
if self.is_switch:
- self.need_serialize = True
+ self.c_need_serialize = True
self.c_container = 'struct'
for bitcase in self.bitcases:
bitcase.c_field_name = _cpp(bitcase.field_name)
@@ -340,7 +340,7 @@ def _c_type_setup(self, name, postfix):
if field.type.is_list:
_c_type_setup(field.type.member, field.field_type, ())
if (field.type.nmemb is None):
- self.need_sizeof = True
+ self.c_need_sizeof = True
field.c_field_type = _t(field.field_type)
field.c_field_const_type = ('' if field.type.nmemb == 1 else 'const ') + field.c_field_type
@@ -357,9 +357,9 @@ def _c_type_setup(self, name, postfix):
if field.type.is_switch:
field.c_pointer = '*'
field.c_field_const_type = 'const ' + field.c_field_type
- self.need_aux = True
+ self.c_need_aux = True
elif not field.type.fixed_size() and not field.type.is_bitcase:
- self.need_sizeof = True
+ self.c_need_sizeof = True
field.c_iterator_type = _t(field.field_type + ('iterator',)) # xcb_fieldtype_iterator_t
field.c_iterator_name = _n(name + (field.field_name, 'iterator')) # xcb_container_field_iterator
@@ -379,20 +379,20 @@ def _c_type_setup(self, name, postfix):
# special case: intermixed fixed and variable size fields
if prev_varsized_field is not None and not field.type.is_pad and field.wire:
if not self.is_union:
- self.need_serialize = True
- self.var_followed_by_fixed_fields = True
+ self.c_need_serialize = True
+ self.c_var_followed_by_fixed_fields = True
else:
self.last_varsized_field = field
prev_varsized_field = field
prev_varsized_offset = 0
- if self.var_followed_by_fixed_fields:
+ if self.c_var_followed_by_fixed_fields:
if field.type.fixed_size():
field.prev_varsized_field = None
- if self.need_serialize:
+ if self.c_need_serialize:
# when _unserialize() is wanted, create _sizeof() as well for consistency reasons
- self.need_sizeof = True
+ self.c_need_sizeof = True
# as switch does never appear at toplevel,
# continue here with type construction
@@ -408,7 +408,7 @@ def _c_type_setup(self, name, postfix):
# _c_iterator(field.type, field_name) necessary
Reply to: