|
Why does the analyzer report
syntax errors? The code works with my compiler.
- There are
many reasons why CC-RIDER may be reporting syntax
and other errors for code that compiles in your
compiler. The most common is: missing or improper
predefined macro definitions in your Compiler
Definitions File. Edit the .DEF file for your
CC-RIDER project and make sure the correct macros
are defined according to your compiler's
documentation. There are also some language
features that your compiler is not providing
properly. See the other FAQ's for more detail.
I am getting syntax errors
some time after my first .C or .CPP module has been
analyzed. Why? The code compiles fine.
- A compiler
only looks at one module at a time, whereas the
CC-RIDER analyzer looks at your entire
application source as one unit. This can cause
name conflicts and varying #if/#endif blocks in
headers #include'd differently by different
modules in the system. CC-RIDER contains a number
of options to solve these kind of problems. Make
sure the "Separate Scopes" option (-s)
is used to keep macros undefined that are not
explicitly defined by a particular module (e.g.
by #include'ing a file containing the #define for
it). It sometimes helps to build a
"dummy" module (e.g. dummy.c) which
#include's many (or all) of the headers used by
your program. This "precompiles" them
into the CC-RIDER database if you place the
"dummy.c" module at the beginning of
your module list in the project file. If you
still are getting errors, try to isolate the
problem to 1 or 2 headers that are being used
differently by different modules. Then try the
"Reprocessing" options under the
Analyzer Setup - Header Reprocessing dialog.
Specify the troublesome header files to be
re-parsed whenever they are encountered. Also,
try the -rl variant to help performance. You can
even resort to full reprocessing for all header
files for each module.
-- C++ only --
I am getting syntax errors near
'true', 'false' and 'bool'. Why?
- These C++
keywords were added to the language fairly
recently by the ANSI/ISO C++ Standards Committee.
The Analyzer fully supports these keywords. Many
commercial C++ compilers, however, do not support
them yet. If your (or your compiler's) code uses
these keywords as, for example, a typedef or enum
value, you must specify the "No bool
support" option (-fB). This option is a
checkbox in the Analyzer Setup - Analyzer Options
dialog.
I am getting a 'missing
declarator' error near 'typedef short wchar_t;'. Why?
- 'wchar_t' is
now a keyword in the C++ language. If you are
using an older C++ compiler, it may be trying to
define this as a typedef. You must specify the
"No wchar_t support" option (-fw). This
option is a checkbox in the Analyzer Setup -
Analyzer Options dialog.
Why are errors reported near
the following class declaration?
class a {
a::a();
};
- Is is not
legal to specify the class qualifier 'a::' in a
member declaration. Some compilers (e.g.
Microsoft C++) do not flag this error, however.
CC-RIDER does.
Errors are reported near the
following class template declaration. Why?
template class t {
.. various legal member declarations ..
}
- There is a
missing semicolon at the end of the declaration.
Many compilers do not catch this error. The
Analyzer does.
|