From: Mike Bland [mailto:[email protected]]
Sent: Saturday, June 07, 2014 6:36 PM
>
> Just created https://github.com/openssl/openssl/pull/126 with what I
> hope is a workable solution.
104 +#if __STDC_VERSION__ < 199901L
105 +#define testutil_stringify_helper(s) #s
106 +#define testutil_stringify(s) testutil_stringify_helper(s)
107 +#define TEST_CASE_NAME __FILE__ ":" testutil_stringify(__LINE__)
108 +#elif defined(_MSC_VER)
109 +#define TEST_CASE_NAME __FUNCTION__
110 +#else
111 +#define TEST_CASE_NAME __func__
112 +#endif /* __STDC_VERSION */
The _MSC_VER block will never be used since MSC is does not claim C99
conformance.
#if __STDC_VERSION__ < 199901L
#if defined(_MSC_VER)
#define TEST_CASE_NAME __FUNCTION__
#else
#define testutil_stringify_helper(s) #s
#define testutil_stringify(s) testutil_stringify_helper(s)
#define TEST_CASE_NAME __FILE__ ":" testutil_stringify(__LINE__)
#endif /* _MSC_VER */
#else
#define TEST_CASE_NAME __func__
#endif /* __STDC_VERSION__ */
or similar should do the trick.
Regards,
jjf
> On Sat, Jun 7, 2014 at 9:55 AM, Mike Bland <[email protected]> wrote:
> > On Sat, Jun 7, 2014 at 4:33 AM, Tim Hudson <[email protected]> wrote:
> >> On 7/06/2014 4:02 AM, Dr. Stephen Henson wrote:
> >>> On Fri, Jun 06, 2014, Mike Bland wrote:
> >>>
> >>>> __func__ is defined in C99. What version of the SGI C compiler are
> you
> >>>> using? According to the following, as of version 7.4, the -c99
> flag
> >>>> should enable this to compile:
> >>>>
> >>>> http://www.sgi.com/products/software/irix/tools/c.html
> >>>>
> >>> Note that VC++ under Windows doesn't support __func__ either. Well
> at least
> >>> the versions I tested didn't.
> >
> > Unfortunately I know next to nothing about VC++, but perhaps it also
> > supports a -C99 switch?
> >
> >> Adding in C99 dependencies in the code will run into a lot of non-
> C99
> >> environments which still are being actively used.
> >> I think it is time to either decide that C99 is now a requirement
> (and
> >> there are features in C99 that would be nice to be able to use) or
> to
> >> decide that code which uses those features shouldn't go in - i.e.
> don't
> >> use those features so that platforms which don't support C99 are
> still
> >> supportable.
> >>
> >> Either approach leads to things breaking for at least some users ...
> >>
> >> In this particular case (the ssl/heartbeat_test.c) the use of
> __func__
> >> really isn't critical and can easily be changed to not be a C99
> __func__
> >> dependency and pass in a test name in the 9 locations rather than
> the
> >> function name. That would fix the couple of platforms already noted
> that
> >> had issues.
> >
> > I certainly don't want to argue that unit testing alone is sufficient
> > reason to force the use of C99. (Well, were it my project... ;-) That
> > said, I imagine there's a lot more than the convenience of __func__
> to
> > be gained from an upgrade. It is a fifteen-year-old standard; I'm
> just
> > getting my feet wet with the OpenSSL code, but even in my limited
> > experience with ssl/heartbeat_test.c, I'm getting a feel for the kind
> > of workarounds that an upgrade would render unnecessary.
> >
> > There's already been a recent thread debating whether older platforms
> > should be supported, or how they should be supported. Since I'm a
> n00b
> > here, I don't want to jump into the middle of a debate I don't have
> > enough context for, but that's how I see things for now.
> >
> > In the meanwhile, I'm looking into how to work around the lack of
> > support for __func__ on non-C99 platforms.
> >
> > Mike
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [email protected]