[libxcb,13/18] c_client.py: use C99 initializers instead of comments

Submitted by Ran Benita on Oct. 12, 2014, 6:58 p.m.

Details

Message ID 1413140300-20075-14-git-send-email-ran234@gmail.com
State Accepted
Headers show

Not browsing as part of any series.

Commit Message

Ran Benita Oct. 12, 2014, 6:58 p.m.
Signed-off-by: Ran Benita <ran234@gmail.com>
---
 src/c_client.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/c_client.py b/src/c_client.py
index eab4006..1c77bb0 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1948,10 +1948,10 @@  def _c_request_helper(self, name, cookie_type, void, regular, aux=False, reply_f
 
     _c('{')
     _c('    static const xcb_protocol_request_t xcb_req = {')
-    _c('        /* count */ %d,', count)
-    _c('        /* ext */ %s,', func_ext_global)
-    _c('        /* opcode */ %s,', self.c_request_name.upper())
-    _c('        /* isvoid */ %d', 1 if void else 0)
+    _c('        .count = %d,', count)
+    _c('        .ext = %s,', func_ext_global)
+    _c('        .opcode = %s,', self.c_request_name.upper())
+    _c('        .isvoid = %d', 1 if void else 0)
     _c('    };')
     _c('')
 

Comments

On Sat, Oct 25, 2014 at 06:26:15PM +0200, Christian Linhart wrote:
> Sequence and names do match correctly as can be seen by comparing it
> with the definition of xcb_protocol_request_t:
> http://cgit.freedesktop.org/xcb/libxcb/tree/src/xcbext.h#n47
> 
> Therefore this does the same, however there may be another problem:
> 
> Is this the first instance in XCB which requires a C99-compliant compiler?

I found a use of "static inline" in xcb_out.c and the following in
xcb_conn.c:

    #if HAVE_SENDMSG
            [...]
            struct msghdr msg = {
                .msg_name = NULL,
                .msg_namelen = 0,
                .msg_iov = *vector,
                .msg_iovlen = n,
                .msg_control = cmsgbuf.buf,
                .msg_controllen = CMSG_LEN(c->out.out_fd.nfd * sizeof (int)),
            };

And we also use AC_PROG_CC_99 (through xorg-macros) so I think it's OK.

> Intuitively it should be safe to assume that a C99 compliant compiler is available on all relevant platforms.
> 
> But I have one test computer which uses X11 and where this is not the case.
> This test computer is from one of my customers and matches their production system ( at least somehow ).
> XCB may become relevant on that computer.
> 
> This may be a hint that there are more users where pre-C99 compatibility can be relevant.

If xcb needs to be more portable to old compilers, there are few enough
c99isms that I think a patch to remove them will be accepted. But it's
probably better to first see which parts fail to compile.

Ran