Bug #12327 macro "rest" in include/my_list.h named poorly, clashes with user code
Submitted: 2 Aug 2005 22:30 Modified: 17 Aug 2005 17:33
Reporter: John Fisher-Ogden Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.25, 4.1.13 OS:Linux (Linux (RedHat 9))
Assigned to: Jim Winstead

[2 Aug 2005 22:30] John Fisher-Ogden
include/my_list.h, which gets included by user code, commits the awful sin
of defining 'rest' as a macro to manipulate lists.
This clashes with any user program that uses 'rest' as an identifier.
The other list macros in that file all have names starting with list_, so
the obvious fix is simply to rename it list_rest.

For completeness, here is some sample code, and 
the error messages it causes:

#include "my_list.h"

class Foo {
void rest() {}

test.cc:4: macro `rest' used without args

test.cc:4: error: expected unqualified-id before ')' token
test.cc:4: error: expected `)' before '->' token

How to repeat:
Compile the code given above.

Suggested fix:
Apply http://www.cs.ucsd.edu/~jfisherogden/list_rest_40.patch and http://www.cs.ucsd.edu/~jfisherogden/list_rest_41.patch for MySQL 4.0 and 4.1 respectively.
[10 Aug 2005 1:01] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[15 Aug 2005 22:22] Jim Winstead
Fixed in 4.1.14 and 5.0.12.
[17 Aug 2005 17:33] Paul Dubois
Noted in 4.1.14, 5.0.12 changelogs.