Konstantin Osipov wrote:
> * Mats Kindahl <mats@stripped> [09/06/23 15:30]:
>> 2797 Mats Kindahl 2009-06-23
>> WL#5016: Fix header file include guards
This was wrong, it was supposed to be
WL#5017: Make header files self-sufficient
I will have to re-commit anyway since it proved that the files in sql/ is not
that easy to make self sufficient without breaking up mysql_priv.h first.
> Don't you want to change the header guards style to follow the
> accepted convention first?
>
> Secondly, how do you test?
I have a shell script that goes through all header files (each in $path) and
execute:
gcc -c -x c++ -I`dirname $path` -Iinclude $path
I was reluctant to add that to the patch since it is not portable.
> I suggest that for each header we add a .c file that just includes
> this header. Then we can have a unit test that is a collection of
> .o built from these artificial .c files, it purpose would just be
> to test that compiling and linking works okay.
I don't think we should try to link at this point, but at later stages, it might
be feasible to do such tests.
> Do you have other plans or ideas?
Yes, checking that a symbol is defined in the component where it is declared.
That can be accomplished by extracting the variable declarations, and then check
the .o file for the symbols to ensure that they are really there.
>> Making header files in include/ self-sufficient, except the following:
>>
>> include/atomic/generic-msvc.h # MSCV-specific
>> include/m_string.h # Used by libmysql
>> include/my_alloc.h # Part of ABI
>> include/mysql/service_thd_alloc.h # Part of ABI
>> include/mysql/services.h # Part of ABI
>> include/mysql_com.h # Part of ABI
>> include/mysql_time.h # Part of ABI
>> include/typelib.h # Part of ABI
>
> How can you break the compilation or the ABI by adding header
> guards to these files or making them self-sufficient?
Wrong title above, this patch adds #include to the files
>> include/mysqld_ername.h # Generated file
>> include/mysqld_error.h # Generated file
>> include/sql_state.h # Generated file
>
> Change the generator to add #ifndef HEADER_GUARD #include <body>
> #else <error>?
Good idea.
>> include/maria.h # Dependent on storage engine headers
> (!)
>
> This one should be removed from azalea, since maria is not in it.
OK.
>> include/config-netware.h # Netware-specific
>
> I believe we can remove all netware infrastructe as well, needs to be
> checked with the build team.
>
>> include/config-win.h # Windows-specific
>
> The file is not designed to be included directly, only through
> my_config.h. Add header guards that enforce that?
I can do that, but I cannot test it since I am running on Linux.
Just my few cents,
Mats Kindahl
--
Mats Kindahl
Senior Software Engineer
Database Technology Group
Sun Microsystems