v10p0a.pat
来自「开放源码的编译器open watcom 1.6.0版的源代码」· PAT 代码 · 共 1,313 行 · 第 1/3 页
PAT
1,313 行
Version 10.0 Level C Patches
****************************
::::94/09/06 (AFS)
Allow:
extern "C" int __cdecl x;
Must be extern "C" for __cdecl to take effect since variables
have their type mangled into the name for "C++" linkage.
Work-around: fabricate a #pragma that sets the underscore
===========================================================
::::94/09/06 (AFS)
Removed warning for "always true/false" expressions if the
sub-expressions are constant values.
Work around: #pragma warning 689 10
#pragma warning 690 10
===========================================================
::::94/09/07 (AFS)
Added support for:
#pragma pack(push,4);
#pragma pack(push);
#pragma pack(pop)
===========================================================
::::94/09/07 (AFS)
Added support for:
#pragma comment(lib,"mylib.lib")
same semantics as:
#pragma library( "mylib.lib" )
===========================================================
::::94/09/07 (AFS)
Added support for expanding macros in code_seg/data_seg
pragmas:
#define DATA_SEG_NAME "MYDATA"
#define CODE_SEG_NAME "MYCODE"
#pragma data_seg( DATA_SEG_NAME )
int x = 3;
#pragma code_seg( CODE_SEG_NAME )
int fn() {
return x;
}
===========================================================
::::94/09/08 (AFS)
Fixed the 16-bit compiler so that it matches the MS 16-bit
C compiler for the following cases:
if a pascal function is defined when compiling for
Windows, use the fat Windows prologue in the function
if a cdecl function is defined when compiling for
Windows, use the fat Windows prologue in the function
===========================================================
::::94/09/14 (AFS)
Fixed compiler so that #include </dir/file.h> works
as expected (was searching along INCLUDE path only).
===========================================================
::::94/09/15 (AFS)
Fixed a problem where an import was generated in the
object file for a virtual function call. This will
reduce the size of executables under certain circumstances.
===========================================================
::::94/09/15 (AFS)
Removed prohibition of pointer to array of unknown size
declarations.
Example:
int (*p)[];
===========================================================
::::94/09/25 (AFS)
Fixed diagnosis of lexical problems during macro
expansion to remove spurious warnings.
Example:
#define stringize( x ) #x
stringize( 2131231236172637126371273612763612731 )
===========================================================
::::94/10/03 (AFS)
Corrected check for too many bytes in #pragma for
assembler style aux #pragmas.
===========================================================
::::94/10/03 (AFS)
Undeclared class names in elaborated class specifiers
are now declared in the nearest enclosing non-class
scope. Undeclared classes are also allowed in arguments
now.
Example:
struct S {
// used to declared ::S::N but now declares ::N
struct N *p;
};
void foo( struct Z *p ); // declares ::Z
===========================================================
::::94/10/07 (AFS)
Fixed unduly harsh restriction on virtual ...-style
functions. They are now allowed in single inheritance
hierarchies as long as the return type is not changed
when the virtual function is overridden. In multiple
inheritance hierarchies, an implementation restriction
is still present for generating a 'this' adjustment
thunk for virtual ...-style functions.
===========================================================
::::94/10/07 (AFS)
Fixed line # info for multi-line statment expressions
in some weird cases.
===========================================================
::::94/10/11 (AFS)
Fixed function template parsing of user defined
conversions that use an uninstantiated class in
their operator name.
Example:
void ack( int );
template <class T>
struct S {
S( T x )
{
ack( x );
}
};
template <class T>
struct W {
operator S<T>();
};
template <class T>
W<T>::operator S<T>() {
return 0;
}
===========================================================
::::94/10/12 (AFS)
Fixed compiler problem that caused a linker warning
"lazy reference for <virtual-fn> has different default
resolutions" in cases where compiler or programmer
optimized virtual function calls to direct calls
in modules that also contained virtual calls.
T.H
struct S {
virtual int foo() { return __LINE__; }
};
struct T : S {
virtual int foo() { return __LINE__; }
};
T1.CPP
#include "t.h"
struct Q : T {
virtual int foo() { return S::foo() + __LINE__; }
};
void foo( T *p )
{
Q y;
y.foo();
p->foo();
}
T2.CPP
#include "t.h"
void foo( T *p );
void ack( T *p ) {
p->foo();
foo(p);
}
main() {
T q;
ack( &q );
}
===========================================================
::::94/10/11 (JWW)
When a class value is returned and is immediately (in the same
expression) used to call a member function, the value may not
be stored in memory.
Work around: introduce a temporary
struct S {
int v;
int member();
};
S foo();
void example( void )
{
// foo().member(); // replace this line with:
S temp = foo();
temp.member();
}
===========================================================
::::94/10/12 (JWW)
Throwing pointers to functions did not work when the
size of a function pointer is greater than the size
of a data pointer.
Work around: place the function pointer in a class and
throw the class object.
===========================================================
::::94/10/14 (AFS)
Fixed default arg processing for const references to
an abstract class. The following example would not
compile properly:
struct A {
virtual int foo() = 0;
};
A &foo();
void ack( A const &r = foo() );
void bar() {
ack();
}
===========================================================
::::94/10/17 (AFS)
Made "DllMain" default to extern "C" linkage for VC++
compatibility.
===========================================================
::::94/10/18 (AFS)
Duplicated a VC++ language extension that is
necessary to parse the Win95 SDK header files.
Example:
typedef struct S {
} S, const *CSP;
^^^^^- not allowed in ANSI C or current WP for C++
===========================================================
::::94/10/19 (AFS)
Don't warn about starting a nested comment if the comment
is just about to end.
Also fixed the code that figures out where a comment was
started so that a nested comment warning is more helpful.
Example:
/*/////////*/
^-
===========================================================
::::94/10/20 (AFS)
Fixed problem where extra info notes were not being
printed for the error message that exceeded the error
message limit.
Example:
// compile -e2
struct S {
void foo();
};
void foo( S const *p )
{
p->foo();
p->foo();
p->foo();
p->foo();
}
===========================================================
::::94/10/20 (AFS)
Fixed problem where the line # for an error message
was incorrect.
Example:
struct S {
void foo() const;
void bar();
};
void S::foo() const
{
bar();
this->bar();
}
===========================================================
::::94/10/24 (AFS)
Fixed output of browser information for instantiated
function template typedefs.
===========================================================
::::94/10/25 (AFS)
Upgrade C++ parser so that casts and member pointer
dereferences can appear on the left hand side of the
assignment expression without parens.
Example:
p->*mp = 1;
(int&)x = 1;
===========================================================
::::94/10/25 (JWW)
In several cases, when a function return or a construction
was immediately dotted in an expression, the generated code
was incorrect:
Example:
struct S {
int x;
int foo();
};
extern S gorf();
void bar()
{
gorf().foo();
}
Work around:
Break the statement in two:
S temp = gorf();
temp.foo();
===========================================================
::::94/10/25 (JWW)
In several cases, when a function return or a construction
was immediately addressed in an expression, the generated code
was incorrect:
Example:
struct S {
int x;
};
extern void fun( S* );
extern S gorf();
void bar()
{
fun( &gorf() );
}
Work around:
Break the statement in two:
S temp = gorf();
fun( &temp );
===========================================================
::::94/11/01 (AFS)
Added support for:
#pragma error "error message"
Use the ANSI method because it is more portable and
cleaner (MS header files use the less portable
#pragma when there is a perfectly fine portable way
to issue a message).
Portable, clean method:
#error "error message"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?