📄 read80.txt
字号:
standards because this is equivalent to:
int a x;
However if the Macro Concatenation flag is turned on (using the
option +fmc) the two names are in effect pasted together to
produce the equivalent of:
int ax;
Prior to the Ansi standard the only way to perform a
concatenation of this kind was through the device described
above. Now the approved mechanism is through the ## operator.
The option is a means of supporting older programs that are still
employing the older technique.
o Treat carriage Return as Newline (+frn)
If this flag is ON, carriage return characters (0x0D) in the
source input not followed by a Newline (0x0a) are treated as
Newline characters (i.e., as line breaks). This is necessary to
process Macintosh style source code on the PC or Unix or their
derivatives. With this flag ON all three conventions (NL alone,
CR alone, and CR NL in combination) are taken to be a Newline so
that you may mix header files.
o -A(C90)
The -A option (strict ANSI) has been upgraded to conform to the
C99 standard. In particular Elective Note 950 is not issued for
// comments in C code. To obtain the older style you can use the
option -A(C90) which says that if the module is a C module it
should conform strictly to the version of C identified as C90.
To get complaints about the use of // you still need to enable
950.
o --idirectory
This is like -idirectory but places a lower priority on that
directory. All directories specified by -i are searched before
directories named by --i. This is to support compilers that
always search through compiler-provided library header
directories after searching user-provided directories.
Example: suppose there is a header file named 'bar.h' in both
directory '/foo' and directory 'local'. Then:
// in std.lnt:
--i/foo // search foo with low priority
-ilocal // search local with high priority
// in t.cpp:
#include <bar.h> // finds the version in 'local'
o -I- for Sun CC After Lint processes the option -csun, it will
behave as Sun CC does when it encounters the -I- option (Refer to
the Sun C++ User's Guide for details). After this option is
given, quote style headers will not be searched for in the
directory of the including file, and angle bracket header files
will be searched for only in directories that are mentioned in -i
options after the -I-.
o -template
The existing option -template(bits) has a new bit 100 which has
the following meaning. The issue involves instantiating
non-dependent template-id's. In the past (pre 8.00r patch level)
we did not always instantiate these template-id's during a
template definition. Currently we are more aggressive in doing
this instantiation (up to the limits required by the language).
Not all compilers (or even configurations of a particular
compiler) instantiate identically. If you are experiencing
problems owing to this change, you may turn on this flag by using
the following option:
++template( 100 )
Another new bit is 200, which has the following meaning. The
issue involves unqualified name lookup and base classes of
dependent type. Consider the following case:
template<class T> struct A { typedef char B; };
template<class T> struct C : public A<T>
{
int f( const B* ); // ERROR
};
Because of the reference to B in the parameter list of C<T>::f,
this example is ill-formed according to section 14.6.2, paragraph
3 of the 2003 version of the ISO C++ Standard, which states:
"In the definition of a class template or a member of a class
template, if a base class of the class template depends on a
template-parameter, the base class scope is not examined
during unqualified name lookup either at the point of
definition of the class template or member or during an
instantiation of the class template or member."
However, during unqualified name lookup, some popular compilers
do search in dependent (and formerly dependent) base classes both
at template definition and at template instantiation time. To
enable such name lookup behavior in Lint, use ++template(200).
This flag will be ON by default when -cmsc or -cbc are given.
Note that MSVC7.1 does adhere to the Standard in this regard when
given the /Za flag. Therefore, if you compile with /Za, you
should probably also add --template(200) after -cmsc in your Lint
configuration. Users of more recent versions of the Borland
compiler may also choose to disable this -template bit.
Note: With the addition of the 200 bit we are now able to retire
the undocumented bit 40 which enabled what is now the default
(standard- conforming) behavior.
Yet another new bit is 400, which has the following meaning. The
issue involves the use of template parameters in the scope of an
explicit specialization. Consider the following case:
template<class T> struct A;
template<> struct A<int> { T n; }; // ERROR
According to section 14.6.1, paragraph 3 of the 2003 ISO C++
Standard, "The scope of a template-parameter extends from its
point of declaration until the end of its template." So in this
example, "T" is not in scope after the semicolon that terminates
the definition of the primary template of A. Furthermore, there
is nothing to indicate that it is introduced in the scope of
A<int>. However, some compilers (for example, versions 6 and 7
of the Microsoft compiler, as well as some other compilers in a
backwards-compatibility mode) behave as if the template parameter
T had been re-declared at the onset of A<int>. To enable similar
behavior in Lint, use ++template(400). This bit is set
automatically when -cmsc is used.
o multi-thread support
A number of customers have asked for some kind of multi-thread
support. In particular they have asked us for a way to designate
some data as 'Shared' so that only functions that are also marked
'Shared' can access the data; also, Shared functions can only
access Shared data and none other. If it were not for the second
criterion you could use the volatile qualifier.
It so happens that there are a number of old modifier flags that
can be used for this purpose. One such is the keyword 'fortran'.
This keyword is normally not active. When it was active
compilers would use the modifier as a clue to employ a
fortran-like calling sequence for any function so designated.
Lint would simply ignore these intended semantics and restrict
its usage to ensuring that declarations would be consistent with
respect to this modifier. For example, you wouldn't want to pass
a pointer that points to a Fortran function to a pointer that
points to a non-fortran function. These simple
type-qualification semantics can be used as the basis for a new
keyword, in this case 'Shared'.
For example:
//lint -rw_asgn(Shared,fortran)
struct X { void f() Shared; void g(); ... };
X Shared a;
X b;
...
a.f(); // OK
a.g(); // Error
b.f(); // Error
b.g(); // OK
Using functions rather than member functions we can obtain the
same effect.
//lint -rw_asgn(Shared,fortran)
struct X { ... };
void f( struct X Shared * );
void g( struct X * );
struct X Shared a;
struct X b;
...
f( &a ); // OK
g( &a ); // Error
f( &b ); // Error
g( &b ); // OK
In addition to 'fortran' there are a number of other old
modifiers that could be employed including: 'pascal',
'_fastcall', and '_loadds'.
Any such modifier that is used in the formation of a type will be
embedded within that type when the type is displayed for
diagnostic purposes. The name that is used by default will be
the original qualification name. This name will be overridden
when the -rw_asgn option assigns a modifier to some new name.
------ New or Improved Error Messages ------
89 Argument or option too long ('String') -- The length of an
option (shown in String) exceeds an internal limit. Please try
to decompose the option into something smaller. At this
writing the limit is 610 characters.
96 Unmatched left brace for String on Location -- The purpose of
this message is to report the location of a left curly brace
that is unmatched by a right curly brace. Such an unmatched
left curly can be far removed from the point at which the
unbalance was detected (often the end of the compilation unit).
Providing the location of the left curly can be extremely
helpful in determining the source of the imbalance.
155 Ignoring { }'ed sequence within an expression, 0 assumed --
Some compilers support what looks like a compound statement as
a C/C++ expression. For example to define the absolute value
of an integer which guarantees that it will be read only once
you may use:
#define abs(a) { int b = a; b >= 0 ? b : -b; }
The last expression in the list is the result. To
syntactically support the construct without running amuck we
recognize the sequence and issue this message. If you want to
use the facility just suppress the message.
156 Braced initializer for scalar type 'Name' -- An example of an
initializer that will draw this complaint is as follows.
int s[] = { { 1 } };
After the compiler has seen the first curly it is expecting to
see a number (or other numeric expression). Compilers that
strictly adhere to the ISO C and C++ Standards will flag this
as ill-formed code.
Note that it is legal (but somewhat arcane) to employ a left
curly at the top-level when initializing an object of scalar
type. For example, the following is well-formed:
int i = { 0 }; // OK; initialize scalar i with 0.
char *t = { "bar" }; // OK; initialize scalar t with a pointer to
// a statically allocated array.
Also note: as the example above implies, this message can apply
to pointers to arrays of char; it does not apply to arrays.
157 No data may follow an incomplete array -- An incomplete array
is allowed within a struct of a C99 or C++ program but no data
is allowed to appear after this array. For example:
struct A { int x; int a[]; int b; };
This diagnostic is issued when the 'b' is seen.
326 String 'String ...' too long, exceeds Integer characters -- A
string (first 40 characters provided in the message) exceeds
some internal limit (provided in the message). There is no
antidote to this condition in the form of an option. FlexeLint
customers may recompile with a redefinition of either M_STRING
(maximum string) or M_NAME (maximum name). To override the
definition in custom.h we suggest recompiling with an
appropriate -dvar=value option assuming your compiler supports
the option.
449 Pointer variable 'Symbol' previously deallocated -- A pointer
variable (designated in the message) was freed or deleted in an
earlier statement.
452 typedef Symbol 'Symbol' redeclared (TypeDiff) conflicts with
Location", -- A typedef symbol is being declared to be a
different type. This can be legal, especially with multiple
modules, but is not good programming practice. It interferes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -