Thread: BUG #2665: VC++ 8 (Visual Studio 2005)

BUG #2665: VC++ 8 (Visual Studio 2005)

From
"Oliver Artelt"
Date:
The following bug has been logged online:

Bug reference:      2665
Logged by:          Oliver Artelt
Email address:      oli@cubeoffice.de
PostgreSQL version: 8.2 beta 1
Operating system:   WinXP + SP2
Description:        VC++ 8 (Visual Studio 2005)
Details:

... the libpq doesn't compile because the compiler does not know the keyword
inline - after removing it works :-(

so long...

Re: BUG #2665: VC++ 8 (Visual Studio 2005)

From
Bruce Momjian
Date:
Oliver Artelt wrote:
>
> The following bug has been logged online:
>
> Bug reference:      2665
> Logged by:          Oliver Artelt
> Email address:      oli@cubeoffice.de
> PostgreSQL version: 8.2 beta 1
> Operating system:   WinXP + SP2
> Description:        VC++ 8 (Visual Studio 2005)
> Details:
>
> ... the libpq doesn't compile because the compiler does not know the keyword
> inline - after removing it works :-(

Interesting.  We have inline redefined in src/include/port/win32.h.  Can
you find out why you are not getting those redefined?

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: BUG #2665: VC++ 8 (Visual Studio 2005)

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
> Interesting.  We have inline redefined in src/include/port/win32.h.  Can
> you find out why you are not getting those redefined?

AFAICS, all the "#ifdef WIN32_ONLY_COMPILER" code in win32.h is dead
code, because c.h doesn't #define WIN32_ONLY_COMPILER until *after* it's
included pg_config_os.h.  It would appear that most of it is indeed
useless and should be removed.

            regards, tom lane

Re: BUG #2665: VC++ 8 (Visual Studio 2005)

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Interesting.  We have inline redefined in src/include/port/win32.h.  Can
> > you find out why you are not getting those redefined?
>
> AFAICS, all the "#ifdef WIN32_ONLY_COMPILER" code in win32.h is dead
> code, because c.h doesn't #define WIN32_ONLY_COMPILER until *after* it's
> included pg_config_os.h.  It would appear that most of it is indeed
> useless and should be removed.

Uh, I think we still do have reasons to test if we are using MSVC or
Borland C.  I think the #define should just be moved up in c.h.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: BUG #2665: VC++ 8 (Visual Studio 2005)

From
Tom Lane
Date:
Bruce Momjian <bruce@momjian.us> writes:
> Uh, I think we still do have reasons to test if we are using MSVC or
> Borland C.  I think the #define should just be moved up in c.h.

Current evidence says otherwise --- but if you insist, why not put the
define in win32.h in the first place, instead of cluttering c.h with it?

            regards, tom lane

Re: BUG #2665: VC++ 8 (Visual Studio 2005)

From
Bruce Momjian
Date:
Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > Uh, I think we still do have reasons to test if we are using MSVC or
> > Borland C.  I think the #define should just be moved up in c.h.
>
> Current evidence says otherwise --- but if you insist, why not put the
> define in win32.h in the first place, instead of cluttering c.h with it?

Well, we certainly need the define for the __inline macro, because was
reported as the bug.

I moved the define to win32.h as you suggested, attached, applied.

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/c.h,v
retrieving revision 1.211
diff -c -c -r1.211 c.h
*** src/include/c.h    10 Aug 2006 01:41:29 -0000    1.211
--- src/include/c.h    3 Oct 2006 03:56:34 -0000
***************
*** 58,69 ****
  #include "postgres_ext.h"
  #include "pg_trace.h"

- #if defined(_MSC_VER) || defined(__BORLANDC__)
- #define    WIN32_ONLY_COMPILER
  #if defined(__BORLANDC__) || (_MSC_VER > 1400)
  #include <crtdefs.h>
  #endif
- #endif

  #include <stdio.h>
  #include <stdlib.h>
--- 58,66 ----
Index: src/include/port/win32.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.59
diff -c -c -r1.59 win32.h
*** src/include/port/win32.h    16 Sep 2006 13:35:49 -0000    1.59
--- src/include/port/win32.h    3 Oct 2006 03:56:34 -0000
***************
*** 1,5 ****
--- 1,9 ----
  /* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.59 2006/09/16 13:35:49 tgl Exp $ */

+ #if defined(_MSC_VER) || defined(__BORLANDC__)
+ #define    WIN32_ONLY_COMPILER
+ #endif
+
  /* undefine and redefine after #include */
  #undef mkdir