Re: [HACKERS] Problem with ControlFileData structure being ABI depe ndent - Mailing list pgsql-patches

From Dave Page
Subject Re: [HACKERS] Problem with ControlFileData structure being ABI depe ndent
Date
Msg-id 475D0D57.2040905@postgresql.org
Whole thread Raw
Responses Re: [HACKERS] Problem with ControlFileData structure being ABI depe ndent
List pgsql-patches
Dave Page wrote:
> Tom Lane wrote:
>> Dave Page <dpage@postgresql.org> writes:
>>> Gregory Stark wrote:
>>>> An alternative is leaving it in the project file but putting
>>>> something like
>>>> this in c.h:
>>
>> Put it in win32.h, please.  c.h shouldn't get cluttered with
>> platform-specific kluges when there's no need for it.
>>
>> Is there a good reason not to just #define _USE_32BIT_TIME_T in win32.h?
>
> Yeah, the fact that addons may then end up partially compiled with and
> partially without it being defined. It we just have it error as Greg
> suggested, then it will force the authors to define it themselves, and
> if they get that wrong it's their fault not ours.

Patch attached.

/D
Index: src/include/port/win32.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.81
diff -c -r1.81 win32.h
*** src/include/port/win32.h    24 Nov 2007 01:55:26 -0000    1.81
--- src/include/port/win32.h    10 Dec 2007 09:42:44 -0000
***************
*** 45,50 ****
--- 45,61 ----

  #define USES_WINSOCK

+ /*
+  * Ensure that anyone building an extension is using a 32 bit time_t.
+  * On Mingw/Msys, that should always be the case, but MSVC++ defaults
+  * to 64 bits. We set that for our own build in the project files
+  */
+ #ifdef WIN32
+ #ifndef _USE_32BIT_TIME_T
+ #error "Postgres uses 32 bit time_t - add #define _USE_32BIT_TIME_T on Windows
+ #endif
+ #endif
+
  /* defines for dynamic linking on Win32 platform */
  #if defined(WIN32) || defined(__CYGWIN__)

Index: src/tools/msvc/Project.pm
===================================================================
RCS file: /projects/cvsroot/pgsql/src/tools/msvc/Project.pm,v
retrieving revision 1.14
diff -c -r1.14 Project.pm
*** src/tools/msvc/Project.pm    21 Aug 2007 15:10:41 -0000    1.14
--- src/tools/msvc/Project.pm    7 Dec 2007 11:14:29 -0000
***************
*** 489,495 ****
      ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
      <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"

AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
!
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE$self->{defines}$p->{defs}"
          StringPooling="$p->{strpool}"
          RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
  EOF
--- 489,495 ----
      ConfigurationType="$cfgtype" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"
WholeProgramOptimization="$p->{wholeopt}">
      <Tool Name="VCCLCompilerTool" Optimization="$p->{opt}"

AdditionalIncludeDirectories="$self->{prefixincludes}src/include;src/include/port/win32;src/include/port/win32_msvc;$self->{includes}"
!
PreprocessorDefinitions="WIN32;_WINDOWS;__WINDOWS__;__WIN32__;EXEC_BACKEND;WIN32_STACK_RLIMIT=4194304;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_USE_32BIT_TIME_T$self->{defines}$p->{defs}"
          StringPooling="$p->{strpool}"
          RuntimeLibrary="$p->{runtime}" DisableSpecificWarnings="$self->{disablewarnings}"
  EOF

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pt_BR FAQ update
Next
From: Bruce Momjian
Date:
Subject: Re: plpgsql, forc statement