swig/swig — pull request #199 by rick-monster (2014-07-28 14:10:01+00:00)
Title: operator precedence was back to front

Found a bug in common lisp bindings for nanomsg, then traced this back to a bug in swig.

C header file:
#define NN_PROTO_PIPELINE 5

#define NN_PUSH (NN_PROTO_PIPELINE * 16 + 0)
#define NN_PULL (NN_PROTO_PIPELINE * 16 + 1)

generated common lisp:
(cl:defconstant #.(lispify "NN_PULL" 'constant) (cl:* 5 (cl:+ 16 1)))

Whereas * should be evaluated before + , like so:

(cl:defconstant #.(lispify "NN_PULL" 'constant) (cl:+ (cl:* 5 16) 1))

What a beautiful computer bug!