Bug #7624 Compilation failure: Missing prototype
Submitted: 3 Jan 2005 11:18 Modified: 4 Jan 2005 12:27
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.0.3-pre OS:IBM AIX (AIX, IRIX)
Assigned to: Vadim Tkachenko CPU Architecture:Any

[3 Jan 2005 11:18] Joerg Bruehe
Description:
On AIX (both 4.3 and 5.2, 32 and 64 bit) and on IRIX (32 and 64 bit), compiling the server fails for this reason (message from IRIX):

=== cut ===
cc   ...   -c btr0sea.c
cc-1196 cc: WARNING File = btr0sea.c, Line = 139
  The indicated function is declared implicitly.
        rw_lock_create(&btr_search_latch);
        ^
cc-1164 cc: ERROR File = btr0sea.c, Line = 139
  Argument of type "int" is incompatible with parameter of type "const char *".
        rw_lock_create(&btr_search_latch);
        ^
=== cut ===

Current chageset is:
1.1753 04/12/31 15:14:17 heikki@hundin.mysql.fi +1 -0
  row0upd.c:
    Manually merge the little InnoDB bug fix from 4.1 to 5.0; Marko can then run tests on the fixed version

This had worked with a pull on Dec 23 with latest changeset:
1.1744 04/12/23 13:35:34 gluh@gluh.mysql.r18.ru +3 -0
  Bug#7219 information_schema: errors in "columns"
  changed field names in 'collations' table(discussed with PGulutzan)

In the Changelog, the only change which might be relevant is the re-formatting of file 'innobase/include/sync0rw.h' which now splits the macro definition onto two lines:

-marko      1.7        | #define rw_lock_create(L)	rw_lock_create_func((L), __FILE__, __LINE__)
+vtkachenko 1.10       | #define rw_lock_create(L) rw_lock_create_func(\
+vtkachenko 1.9        |             (L), __FILE__, __LINE__, __STRING(L))

How to repeat:
Try to build on all platforms.

Suggested fix:
Revert the formatting change to have a one-line definition, or at least the first parameter on the first line.
(Not sure whether this is the real reason, just the only suitable observation.)
[3 Jan 2005 15:44] Joerg Bruehe
I checked on 'aix43': It is not the formatting - even if the macro definition is a one-liner, it fails the same way.
But I found that the cpp functionality of '__STRING()' seems to be the reason: When I replace '__STRING(L)' in the macro definition by a constant string "missing", the module compiles. Compilation then fails in 'buf0buf.c' on the call to 'mutex_create()' in line 530, which again is a macro whose definition includes a call to '__STRING(L)'.

On other platforms, we have error messages about '__STRING' being undefined.

So it is the use of '__STRING' that causes these problems.
[3 Jan 2005 19:10] Heikki Tuuri
Vadim,

the following code in ut0dbg.h compiles on all platforms. Maybe best to use 
#?

Regards,

Heikki

#define ut_a(EXPR) do {\
        if (!((ulint)(EXPR) + ut_dbg_zero)) {\
                ut_print_timestamp(stderr);\
                fprintf(stderr, ut_dbg_msg_assert_fail,\
                os_thread_pf(os_thread_get_curr_id()), __FILE__,\
                (ulint)__LINE__);\
                fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
                fputs(ut_dbg_msg_trap, stderr);\
                ut_dbg_stop_threads = TRUE;\
                if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
        }\
        if (ut_dbg_stop_threads) {\
                fprintf(stderr, ut_dbg_msg_stop,\
     os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
                os_thread_sleep(1000000000);\
        }\
} while (0)

#define ut_error do {\
        ut_print_timestamp(stderr);\
        fprintf(stderr, ut_dbg_msg_assert_fail,\
        os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
        fprintf(stderr, ut_dbg_msg_trap);\
        ut_dbg_stop_threads = TRUE;\
        if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
} while (0)
[4 Jan 2005 12:27] Vadim Tkachenko
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

I replaced __STRING() with #