Bug #34309 '_PC' : macro redefinition
Submitted: 5 Feb 2008 13:55 Modified: 16 Jun 2009 13:31
Reporter: Roberto Giovannelli Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S1 (Critical)
Version:5.0/5.1/6.0 OS:Windows
Assigned to: Davi Arnaut CPU Architecture:Any

[5 Feb 2008 13:55] Roberto Giovannelli
Description:
How can I avoid the warning: 

Warning C4005: '_PC': macro redefinition 
C: \ Program \ Microsoft Visual Studio \ VC98 \ INCLUDE \ tchar.h (776): see previous definition of '_PC'

My #include are:

#include <tchar.h>
#include "my_global.h"
#include <mysql.h>
#include <stdio.h>
#include <CTime>

I have no link problems , but runtime errors

thanks...

roberto

How to repeat:
Incompatibilities between tchar.h and my_global.h
[5 Feb 2008 15:12] MySQL Verification Team
Thank you for the bug report.

my_global.h

/*
  Support macros for non ansi & other old compilers. Since such
  things are no longer supported we do nothing. We keep then since
  some of our code may still be needed to upgrade old customers.
*/
#define _VARARGS(X) X
#define _STATIC_VARARGS(X) X
#define _PC(X)	X

tchar.h

#define _CPUC   const unsigned char *
#define _PC     char *

bug25714.c
C:\Arquivos de programas\Microsoft Visual Studio .NET 2003\Vc7\include\tchar.h(833) : warning C4005: '_PC' : macro redefinition
        C:\dbs\mysql-6.0\include\my_global.h(627) : see previous definition of '_PC'
[19 Dec 2008 22:45] Jim Winstead
There is no reason not to fix this in 5.0 or 5.1, at least. The _PC(X) macro can safely be removed from my_global.h -- it's not used anywhere.

Joro, please have someone from your team push this into the 5.0/5.1 trees.

Thanks.
[27 Jan 2009 14:49] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/64152

2751 Chad MILLER	2009-01-27
      Bug#34309: '_PC' macro redefinition
      
      For reasons that are now a mystery, we had defined a CPP symbol to
      help ancient compilers work better (in some way that's lost to history).
      This interferes with at least one modern compiler.
      
      Now, don't define the _PC symbol.  Those other underscore-leading
      symbols are suspect also, but at least the names aren't inscrutable.
      Let's leave them for now.
[12 Feb 2009 4:53] Chad MILLER
Queued to 5.1- and 6.0-bugteam trees.
[14 Feb 2009 13:01] Bugs System
Pushed into 6.0.10-alpha (revid:matthias.leich@sun.com-20090212211028-y72faag15q3z3szy) (version source revid:matthias.leich@sun.com-20090212211028-y72faag15q3z3szy) (merge vers: 6.0.10-alpha) (pib:6)
[27 Feb 2009 20:35] Paul DuBois
Noted in 6.0.10 changelog.

On Windows, the _PC macro in my_global.h was causing problems for 
modern compilers. It has been removed because it is no longer used.

Setting report to NDI pending push into 5.0.x/5.1.x.
[13 Mar 2009 19:02] Bugs System
Pushed into 5.1.33 (revid:joro@sun.com-20090313111355-7bsi1hgkvrg8pdds) (version source revid:vvaintroub@mysql.com-20090218093153-sjzxf01i4ezte0xp) (merge vers: 5.1.33) (pib:6)
[15 Mar 2009 3:00] Paul DuBois
Noted in 5.1.33 changelog.

Setting report to NDI pending push into 5.0.x.
[9 May 2009 16:39] Bugs System
Pushed into 5.1.34-ndb-6.2.18 (revid:jonas@mysql.com-20090508185236-p9b3as7qyauybefl) (version source revid:jonas@mysql.com-20090508100057-30ote4xggi4nq14v) (merge vers: 5.1.33-ndb-6.2.18) (pib:6)
[9 May 2009 17:37] Bugs System
Pushed into 5.1.34-ndb-6.3.25 (revid:jonas@mysql.com-20090509063138-1u3q3v09wnn2txyt) (version source revid:jonas@mysql.com-20090508175813-s6yele2z3oh6o99z) (merge vers: 5.1.33-ndb-6.3.25) (pib:6)
[9 May 2009 18:34] Bugs System
Pushed into 5.1.34-ndb-7.0.6 (revid:jonas@mysql.com-20090509154927-im9a7g846c6u1hzc) (version source revid:jonas@mysql.com-20090509073226-09bljakh9eppogec) (merge vers: 5.1.33-ndb-7.0.6) (pib:6)
[11 May 2009 16:56] Paul DuBois
Setting report to NDI pending push into 5.0.x.
[30 May 2009 15:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/75312

2759 Davi Arnaut	2009-05-30
      MySQL 5.0 backport of Chad Miller's patch for Bug#34309:
      
      Bug#34309: '_PC' macro redefinition
      
      For reasons that are now a mystery, we had defined a CPP symbol to
      help ancient compilers work better (in some way that's lost to history).
      This interferes with at least one modern compiler.
      
      Now, don't define the _PC symbol.  Those other underscore-leading
      symbols are suspect also, but at least the names aren't inscrutable.
      Let's leave them for now.
[30 May 2009 15:39] Davi Arnaut
Queued to 5.0-bugteam
[16 Jun 2009 8:33] Bugs System
Pushed into 5.0.84 (revid:gkodinov@mysql.com-20090616082753-kwe0l8uoictxhojf) (version source revid:zhenxing.he@sun.com-20090531091612-rhrhb6tq2gwos5x7) (merge vers: 5.0.83) (pib:6)
[16 Jun 2009 11:03] Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090616102155-3zhezogudt4uxdyn) (version source revid:zhenxing.he@sun.com-20090531121615-2m1rtj0b2nsw3pww) (merge vers: 5.1.36) (pib:6)
[16 Jun 2009 13:32] Paul DuBois
Noted in 5.0.84 changelog.
[17 Jun 2009 19:21] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:v.narayanan@sun.com-20090601073331-ok8y1rjbmqa3egsj) (merge vers: 6.0.12-alpha) (pib:11)
[26 Aug 2009 13:45] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:32] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)