Skip to content
Browse files

perl.h can include embed.h in the same location on all operating syst…

…ems.

Commit 22c35a8 (October 1988) added a #include "embed.h" later in
perl.h for when building with PERL_OBJECT defined. Commit d18c611
(November 1988) added an effectively duplicate #include for all WIN32.

Commit 0cb9638 (June 1999) corrected the made the earlier #include
in perl.h also conditional on !PERL_OBJECT (in addition to the
!PERL_FOR_X2P added by 22c35a8), but it wasn't until commit
d18c611 (November 1999) that this changed this to !WIN32, and
embed.h was included exactly once by perl.h (as a2p never actually includes
perl.h).

Commit acfe0ab (August 2001) removed the PERL_OBJECT code from
perl.h, reducing the duplication somewhat, but commit 96e176b
(October 2001) created analogous special case duplication for VMS, and
commit 27da23d (April 2005) for Symbian. Commit eb8433b
(March 2006) then neatly put the same #ifndef PERL_MAD code after all 4
locations that included embed.h and commit b3f24c0 (April 2006)
made the same correction in all 4 places.

But, the daft part of all this is that there was no reason why Win32 was
special - every other operating system can build perl with embed.h included
later in perl.h

Hence the earlier 3 locations can be eliminated, and the was-just-Win32
location made unconditional.

Which saves some lines of code. But fewer lines than are in this commit
message.
  • Loading branch information...
1 parent c370e54 commit f9293c5b9a0045314decf8aaed8943100c69b76e Nicholas Clark committed Dec 8, 2011
Showing with 7 additions and 28 deletions.
  1. +7 −28 perl.h
View
35 perl.h
@@ -974,17 +974,6 @@ EXTERN_C int usleep(unsigned int);
#define PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION
#endif
-/* Cannot include embed.h here on Win32 as win32.h has not
- yet been included and defines some config variables e.g. HAVE_INTERP_INTERN
- */
-#if !(defined(WIN32)||defined(VMS))
-# include "embed.h"
-# ifndef PERL_MAD
-# undef op_getmad
-# define op_getmad(arg,pegop,slot) NOOP
-# endif
-#endif
-
#define MEM_SIZE Size_t
/* Round all values passed to malloc up, by default to a multiple of
@@ -2581,11 +2570,6 @@ typedef struct clone_params CLONE_PARAMS;
#if defined(VMS)
# include "vmsish.h"
-# include "embed.h"
-# ifndef PERL_MAD
-# undef op_getmad
-# define op_getmad(arg,pegop,slot) NOOP
-# endif
# define ISHISH "vms"
#endif
@@ -2615,11 +2599,6 @@ typedef struct clone_params CLONE_PARAMS;
#ifdef __SYMBIAN32__
# include "symbian/symbianish.h"
-# include "embed.h"
-# ifndef PERL_MAD
-# undef op_getmad
-# define op_getmad(arg,pegop,slot) NOOP
-# endif
# define ISHISH "symbian"
#endif
@@ -5073,13 +5052,13 @@ END_EXTERN_C
# undef PL_na
#endif
-#if defined(WIN32)
-/* Now all the config stuff is setup we can include embed.h */
-# include "embed.h"
-# ifndef PERL_MAD
-# undef op_getmad
-# define op_getmad(arg,pegop,slot) NOOP
-# endif
+/* Now all the config stuff is setup we can include embed.h
+ In particular, need the relevant *ish file included already, as it may
+ define HAVE_INTERP_INTERN */
+#include "embed.h"
+#ifndef PERL_MAD
+# undef op_getmad
+# define op_getmad(arg,pegop,slot) NOOP
#endif
#ifndef PERL_GLOBAL_STRUCT

0 comments on commit f9293c5

Please sign in to comment.
Something went wrong with that request. Please try again.