This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Oi gcc, No! sizeof(void) is an error. *Not* 1.
authorNicholas Clark <nick@ccl4.org>
Wed, 16 Nov 2005 23:40:55 +0000 (23:40 +0000)
committerNicholas Clark <nick@ccl4.org>
Wed, 16 Nov 2005 23:40:55 +0000 (23:40 +0000)
Wanting sizeof(void) isn't even a compilation error with -ansi
-pedantic. Just a warning. Lame! I'm going to send it back for a full
refund. Hateful software.

p4raw-id: //depot/perl@26143

sv.c

diff --git a/sv.c b/sv.c
index da75a98..f01695b 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1265,16 +1265,16 @@ static int offset_by_svtype[] = {
 
 
 #define new_body_type(sv_type)                 \
-    S_new_body(aTHX_ sizeof_body_by_svtype[sv_type], sv_type)  \
-       + offset_by_svtype[sv_type]
+    (void *)((char *)S_new_body(aTHX_ sizeof_body_by_svtype[sv_type], sv_type)\
+            + offset_by_svtype[sv_type])
 
 #define del_body_type(p, sv_type)      \
     del_body(p, &PL_body_roots[sv_type])
 
 
 #define new_body_allocated(sv_type)            \
-    S_new_body(aTHX_ sizeof_body_by_svtype[sv_type], sv_type)  \
-       + offset_by_svtype[sv_type]
+    (void *)((char *)S_new_body(aTHX_ sizeof_body_by_svtype[sv_type], sv_type)\
+            + offset_by_svtype[sv_type])
 
 #define del_body_allocated(p, sv_type)         \
     del_body(p - offset_by_svtype[sv_type], &PL_body_roots[sv_type])