Lutz Behnke wrote:
> 
> Hi there,
> 
> as I am now starting serious work on the extended EVP interface I have a
> question:
> 
>   Is there any serious reason why the headers use a unfolded prototype
>   definition like
> 
>     #ifndef NOPROTO
>     int foo(char* bar);
>       :
>     #else
>     int foo()
>       :
>     #endif
> 
>   instead of a folded one akin to the GNU style:
> 
>     #ifdef NOPROTO
>     #define _P(proto) ()
>     #else
>     #define _P(proto) (proto)
>     #endif
> 
>     int foo _P(char* bar);
> 
>   which I personally find a lot easier to read and also shortens the
> header file
>   considerably.
> 
>   If there is no reason not to do so I would start with evp.h
> 

I think this is a good idea but it has to be done properly.

There is a problem with the perl script mkdef.pl which builds the
Windows DLL DEF files. 

This specifically parses the NOPROTO stuff to get a list of functions:
it then prints out a list of those which don't have a number (in
util/*.num) and excludes any that do have a number but are not included:
so deleted functions aren't referenced.

If you change the prototype format you need to change the perl script to
handle this. Personally I think:

int func_name _P(whatever);

should be easier to parse provided the parser can find the start
appropriately and isn't confused by things like prototypes of function
pointers in structures.

The easiest way to handle this would be to have a comment like:

/* BEGIN FUNCTION PROTOTYPES */

just before the first actual prototype.

The perl script could then ignore all lines before this and then parse
the file until it found the:

/* BEGIN ERROR CODES */

line. In the case of files without error codes you could have a:

/* END FUNCTION PROTOTYPES */

line or just mandate the use of both in all cases and have the perl
script output an error if it found neither in one of its files.

This need not be an "all or nothing" change. It shouldn't be difficult
to modify the perl script to handle both conventions until everything is
changed.

I think all the header files should be migrated to this format. It is
all too easy to add a new function and forget to add the version without
a prototype in the header file: the Unix environments don't give a
warning because the non prototype form isn't referenced. This then
excludes the new function from the Win32 DLL and you only find problems
when you get unreferenced symbols later.

Steve.
-- 
Dr Stephen N. Henson. UK based freelance Cryptographic Consultant. 
For info see homepage at http://www.drh-consultancy.demon.co.uk/
Email: [EMAIL PROTECTED]
NOTE NEW (13/12/98) PGP key: via homepage.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to