Closed p5pRT closed 9 years ago
C89 ----------------------------------------------------------------- If NDEBUG is defined as a macro name at the point in the source file where \<assert.h> is included\, the assert macro is defined simply as
#define assert(ignore) ((void)0)
The assert macro shall be implemented as a macro\, not as an actual function. ----------------------------------------------------------------
POSIX
----------------------------------------------------------------- If NDEBUG is defined as a macro name before the inclusion of this header\, the /assert/() \<http://pubs.opengroup.org/onlinepubs/009695399/functions/assert.html> macro shall be defined simply as:
#define assert(ignore)((void) 0) ------------------------------------------------
perl.h has ------------------------------------------------
/* Keep the old croak based assert for those who want it\, and as a fallback if the platform is so heretically non-ANSI that it can't assert. */
#define Perl_assert(what) PERL_DEB( \ ((what) ? ((void) 0) : \ (Perl_croak_nocontext("Assertion %s failed: file \"" __FILE__ \ "\"\, line %d"\, STRINGIFY(what)\, __LINE__)\, \ (void) 0)))
/* assert() gets defined if DEBUGGING (and I_ASSERT). * If no DEBUGGING\, the \<assert.h> has not been included. */ #ifndef assert # define assert(what) Perl_assert(what) #endif #ifdef DEBUGGING # define assert_(what) assert(what)\, #else # define assert_(what) #endif ------------------------------------------------ cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -O1 -MD -Zi -DNDEBUG -G7 -GL -DPERL_EXTE RNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\dump.obj ..\dump.c dump.c ..\dump.c(1436) : error C2059: syntax error : '\,' ------------------------------------------------ void * retval; retval = (assert(SvSANITY(sv))\,Perl_do_sumthing(aTHX_ sv)); \<\<\<\<\< line 1436
------------------------------------------------ post CPP ------------------------------------------------ void * retval; retval = (\,Perl_do_sumthing(my_perl\, sv)); ------------------------------------------------
Another variant ------------------------------------------------ void * retval; retval = ((assert(SvSANITY(sv)))\,Perl_do_sumthing(aTHX_ sv)); ------------------------------------------------ cl -c -nologo -GF -W3 -I..\lib\CORE -I.\include -I. -I.. -DWIN32 -D_CONS OLE -DNO_STRICT -DPERLDLL -DPERL_CORE -O1 -MD -Zi -DNDEBUG -G7 -GL -DPERL_EXTE RNAL_GLOB -DPERL_IS_MINIPERL -Fo.\mini\dump.obj ..\dump.c dump.c ..\dump.c(1436) : error C2059: syntax error : ')' ------------------------------------------------ post CPP ------------------------------------------------
retval = (()\,Perl_do_sumthing(my_perl\, sv));
------------------------------------------------ post CPP with DEBUGGING on ----------------------------------------------- retval = (((void)( (SvSANITY(sv)) || (_assert("SvSANITY(sv)"\, "../dump.c"\, 1436)\, 0) ))\,Perl_do_sumthing(my_perl\, sv)); ----------------------------------------------- not a syntax error
The problem is macro PERL_DEB() returns nothing. assert must return "((void)0)" not "" per C/POSIX.
related commits
http://perl5.git.perl.org/perl.git/commitdiff/de84dc04df54774a9a36117a3e6233130e44a9a3 http://perl5.git.perl.org/perl.git/commitdiff/2b0572841e170b6dd3ff1e2adc09565a9efdf3f1
PERL_DEB originates from 5 alpha 2 commit from the moment #define assert was added.
http://perl5.git.perl.org/perl.git/commitdiff/79072805bf63abe5b5978b5928ab00d360ea3e7f
Note Win32 Perl always puts -DNDEBUG on non-DEBUGGING builds on command like\, unix perls never do that for DEBUGGING or non DEBUGGING.
-DNDEBUG has been on win32 Perl since http://perl5.git.perl.org/perl.git/commitdiff/3e3baf6d63945cb64e829d6e5c70a7d00f3d3d03 or perl-5.003_97e http://perl5.git.perl.org/perl.git/commitdiff/137443ea0a858c43f5a720730cac6209a7d41948
I can't find p5p mail for patch " Win32 update (four patches)" there probably was no archiving then.
On Sun Oct 26 15:55:17 2014\, bulk88 wrote:
C89 ----------------------------------------------------------------- If NDEBUG is defined as a macro name at the point in the source file where \<assert.h> is included\, the assert macro is defined simply as
#define assert(ignore) ((void)0)
The assert macro shall be implemented as a macro\, not as an actual function.
Possible patch attached.
Tony
The RT System itself - Status changed from 'new' to 'open'
On Tue Nov 11 18:54:51 2014\, tonyc wrote:
On Sun Oct 26 15:55:17 2014\, bulk88 wrote:
C89 ----------------------------------------------------------------- If NDEBUG is defined as a macro name at the point in the source file where \<assert.h> is included\, the assert macro is defined simply as
#define assert(ignore) ((void)0)
The assert macro shall be implemented as a macro\, not as an actual function.
Possible patch attached.
Applied as 11f9ab1a291e36ad40cb66d0bd0aedce897c06c3.
Tony
@tonycoz - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#123063 (status was 'resolved')
Searchable as RT123063$