digitalmars.D.bugs - [patch] setting predefined version identifiers
- Thomas Kuehne (53/53) Dec 07 2004 -----BEGIN PGP SIGNED MESSAGE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message fixes http://svn.kuehne.cn/dstress/nocompile/version_06.d http://svn.kuehne.cn/dstress/nocompile/version_28.d http://svn.kuehne.cn/dstress/nocompile/version_27.d http://svn.kuehne.cn/dstress/nocompile/version_26.d http://svn.kuehne.cn/dstress/nocompile/version_25.d http://svn.kuehne.cn/dstress/nocompile/version_24.d Note 1: This code should be put in a static function in order to avoid code duplication between "VersionSymbol::VersionSymbol" and "VersionCondition::addGlobalIdent". Note 2: The error messages doesn't contain source names / lines. Thomas --- /opt/digitalmars/109/dmd/src/dmd/version.c 2004-08-30 00:51:18.000000000 +0200 +++ d/dmd/version.c 2004-12-07 19:00:07.737377832 +0100 -83,6 +83,27 VersionSymbol::VersionSymbol(Identifier *ident) : Dsymbol(ident) { + static char* reserved[] = + { + "DigitalMars", + "X86", "AMD64", "IA64" + "Windows", "Win32", "Win64", + "Unix", "linux", "darwin", + "LittleEndian", "BigEndian", + "none", "all" + }; + + for (unsigned i = 0; i < sizeof(reserved) / sizeof(reserved[0]); i++) + { + if (strcmp(ident->string, reserved[i]) == 0) + goto Lerror; + } + + if (ident->string[0] == 'D' && ident->string[1] == '_'){ +Lerror: + error("version identifier '%s' is reserved and cannot be set", ident->string); + } + } VersionSymbol::VersionSymbol(unsigned level) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.13 (GNU/Linux) iD8DBQFBtfKy3w+/yD4P9tIRAtyLAJ9FcOypN1SbMDUFSNZ3LEmhlm+USQCgrajr jNZIc9pvdMhyFGU9uV43QgQ= =QKjN -----END PGP SIGNATURE-----
Dec 07 2004