Contents | < Browse | Browse >
16E. error messages, warnings and the unreferenced check
--------------------------------------------------------
Sometimes, when compiling your source with EC, you get a message
of the sort UNREFERENCED: <ident>, <ident>, ...
This is the case when you have declared variables, functions or labels,
but did not use them. This is an extra service rendered to you by the
compiler to help you find out about those hard to find errors.

There are several warnings that the compiler issues to notify you that
something might be wrong, but is not really an error.


- "A4/A5 used in inline assembly"
  This is the warning you'll get if you use registers A4 or A5 in your
  assembly code. The reason for this is that those registers are used
  internally by E to address the global and local variables respectively.
  Of course there might be a good reason to use these, like doing
  a MOVEM.L A4/A5,-(A7) before a large part of inline assembly code

- "keep an eye on your stacksize"
- "stack is definitely too small"
  Both these may be issued when you use OPT STACK=<size>. The compiler
  will simply match your <size> against its own estimate (see  16C ),
  and issue the former warning if it thinks it's ok but a bit on the small
  side, and the latter if it's probably too small.

- 'suspicious use of "=" in void expressions (s). (line %d)'
  This warning is issued if you write expressions like 'a=1' as a
  statement. One reason for this is the fact that a comparison doesn't
  make much sense as a statement, but the main reason is that it could be
  an often occurring typo for 'a:=1'. Forgetting those ":" may be hard to
  find, and it may have disastrous consequences.

- 'module changed OPT settings'
  If you use a module that has OPT OSVERSION=37, this changes the
  OPT for the main program too. this warning serves to make you aware
  of this. put such an OPT in the main program too to get rid of it.

- 'variable used as function'
  in v3, arbitrary variables may be used as function. this function
  is there to warn you so you don't accidentally do this.

- 'code outside PROCs'
  You wrote E code in between PROCs, which is only rarely useful.

Errors.
The compiler will print the source-code-line that caused the error below it,
with a cursor at the exact spot.  The cursor denotes the spot the compiler was
when it _discovered_ the error, it is thus likely that the token that caused
the error is the one or two tokens just _before_ the cursor, maybe even on
the previous line (i.e. the cursor is always _after_ the error).

- 'syntax error'
  Most common error. This error is issued either when no other
  error is appropriate or your way of ordering code in your sources
  is too abnormal.

- 'unknown keyword/const'
  You have used an identifier in uppercase (like "IF" or "TRUE"), and
  the compiler could not find a definition for it. Causes:
  * mispelled keyword
  * you used a constant, but forgot to define it in a CONST statement
  * you forgot to specify the module where your constant is defined

- '":=" expected'
  You have written a FOR statement or an assignment, and put something
  other than ":=" in its place.

- 'unexpected characters in line'
  You used characters that have no syntactic meaning in E outside of
  a string. examples: "@!&\~"

- 'label expected'
  At some places, for example after the PROC or JUMP keyword,
  a label identifier is required. You wrote something else.

- '"," expected'
  In specifying a list of items (for example a parameter list)
  you wrote something else instead of a comma.

- 'variable expected'
  This construction requires a variable, example:
  FOR <var>:= ... etc.

- 'value does not fit in 32 bit'
  In specifying a constant value (see  2A -2E) you wrote too
  large a number, examples:  $FFFFFFFFF, "abcdef".
  Also occurs when you define a SET of more than 32 elements.

- 'missing apostrophe/quote'
  You forgot the ' at the other end of a string.

- 'incoherent program structure'
  * you started a new PROC before ending the last one
  * you don't nest your loops properly, for example:
    FOR
      IF
      ENDFOR
    ENDIF

- 'illegal command-line option'
  In specifying 'EC -opt source' you wrote something for '-opt'
  that is not a legal option to EC.

- 'division and multiplication 16bit only'
  The compiler detected that you were about to use 32bits
  for * or /. This would not have the desired result at runtime.
  (see  9G , Mul() and Div()).

- 'superfluous items in expression/statement'
  After the compiler already compiled your statement, it still found
  lexical tokens instead of an end of line. You probably forgot
  the <lf> or ";" to separate two statements.

- 'procedure "main" not available'
  Your program does not include a main procedure !

- 'double declaration of label'
  You declared a label twice, for example:
  label:
  PROC label()

- 'unsafe use of "*" or "/"'
  This again has to do with 16bit instead of 32bit * and /.
  See 'division and multiplication 16bit only'.

- "reading sourcefile didn't succeed"
  Check your source spec. that you gave with 'ec mysource'
  make sure the file ends in '.e'

- "writing executable didn't succeed"
  Trying to write the generated code as an executable caused a dos
  error. For example, the executable that did already exist could
  not be overwritten.

- 'no args'
  "USAGE: ec [-opts] <sourcecodefilename> (`.e' is added)"
  You get this by just typing 'ec' without any arguments.

- 'unknown/illegal addressing mode'
  This error is reported only by the inline assembler. Possible causes are:
  * you used some addressing mode that does not exist on the 68000
  * the addressing mode exists, but not for this instruction.
    not all assembly instructions support all combinations of
    effective addresses for source and destination.

- 'unmatched parentheses'
  Your statement has more "(" than ")" or the other way around

- 'double declaration'
  One identifier is used in two or more declarations.

- 'unknown identifier'
  An identifier is not used in any declaration; it is unknown.
  You probably forgot to put it in a DEF statement.

- 'incorrect #of args or use of ()'
  * You forgot to put "(" or ")" at the right spot
  * you supplied the incorrect #of arguments to some function

- 'unknown e/library function'
  You wrote an identifier with the first character in uppercase, and
  the second in lowercase, but the compiler could not find a definition.
  Possible causes:
  * Misspelled name of function
  * You forgot to include the module that defines this library call.

- 'illegal function call'
  Rarely occurs. You get this one if you try to construct weird
  function calls like nested WriteF()'s. Example:
  WriteF(WriteF('hi!'))

- 'unknown format code following "\"'
  You specified a format code in a string which is illegal.
  (see  2F  for a listing of format codes)

- '/* not properly nested comment structure */'
  The #of '/*' is unequal to the #of '*/', or is placed in a funny order.

- 'could not load binary'
  <filespec> in INCBIN <filespec> could not be read.

- '"}" expected'
  You started an expression with "{<var>" , but forgot the "}"

- 'immediate value expected'
  Some constructions require an immediate value instead of an expression.
  Example:
  DEF s[x*y]:STRING   /* wrong: only something like s[100]:STRING is legal */

- 'incorrect size of value'
  You specified an unacceptably large (or small) value for some construction.
  Examples:
  DEF s[-1]:STRING, t[1000000]:STRING    /* needs to be 0..32000  */
  MOVEQ #1000,D2                         /* needs to be -128..127 */

- 'no e code allowed in assembly modus'
  You wish to operate the compiler as an assembler by writing 'OPT ASM',
  but, by accident, wrote some E code.

- 'illegal/inappropriate type'
  At someplace where a <type> spec. was needed, you wrote something
  inappropriate. Examples:
  DEF a:PTR TO ARRAY       /* no such type */
  [1,2,3]:STRING

- '"]" expected'
  You started with "[", but never ended with "]"

- 'statement out of local/global scope'
  A breakpoint of scope is the first PROC statement. before that,
  only global definitions (DEF,CONST,MODULE etc.) are allowed, and no code.
  In the second part, only code and function definitions are legal, no
  global definitions.

- 'could not read module correctly'
  A dos error occurred while trying to read a module from a MODULE
  statement. Causes:
  * emodules: was not assigned properly
  * module name was misspelled, or did not exist in the first place
  * you wrote MODULE 'bla.m' instead of MODULE 'bla'

- 'workspace full!'
  Rarely occurs. If it does, you'll need the '-m' (ADDBUF) option to
  manually force EC to make a bigger estimate on the needed amount of
  memory. Try compiling with -m2, then -m3 until the error disappears.
  You'll probably be writing huge applications with giant amounts
  of data just to even possibly get this error.

- 'not enough memory while (re-)allocating'
  Just like that. Possible solutions:
  1. You were running other programs in multitasking. Leave them and try again.
  2. You were low on memory anyway and your memory was fragmented.
     Try rebooting.
  3. None of 1-2. Buy a memory expansion (um).

- 'incorrect object definition'
  You were being silly while writing the definitions between OBJECT and
  ENDOBJECT. (see  8F  to find out how to do it right).

- 'illegal use of/reference to object'
  If you use expressions like ptr.member, member needs to be a legal
  member of the object ptr is pointing to.

- 'incomplete if-then-else expression'
  If you use IF as an operator (see  4E ), then an ELSE part
  needs to be present: an expression with an IF in it always needs to
  return a value, while a statement with an IF in it can just 'do nothing'
  if no ELSE part is present.

- 'unknown object identifier'
  You used an identifier that was recognised by the compiler as being
  part of some object, but you forgot to declare it. Causes:
  * misspelled name
  * missing module
  * the identifier in the module is spelled not like you expected
    from the RKRM's. Check with ShowModule.
    Note that amiga-system-objects inherit from assembly identifiers,
    not from C. Second: identifiers obey E-syntax.

- 'double declaration of object identifier'
  One identifier used in two object definitions

- 'reference(s) out of 32k range: switch to LARGE model'
  Your program is growing larger than 32k. Simply put 'OPT LARGE'
  in your source and code on. (see  16B ).

- 'reference(s) out of 256 byte range'
  You probably wrote BRA.S or Bcc.S over too great a distance.

- 'too sizy expression'
  You used a string '' or list [], possibly recursive [[]], that is too sizy.

- 'incomplete exception handler definition'
  You probably used EXCEPT without HANDLE, or the other way round
  (see  13A  on exception handling).

- 'not allowed in a module'
  You're doing one of the few things you can't do in a module,
  such as global variables with initialisations.

- 'allowed in modules only'
  you probably use EXPORT in your main source

- 'this doesn't make sense'
  general error.

- 'you need a newer version of EC for this :-)'
  You probably use a module that was compiled with a newer
  version of EC than you currently have.

- 'no matching "["'
  within a statement, a "]" was found, without a matching "]".

- 'this instruction needs a better CPU/FPU (see
  You use a construction (probably an asm instruction) that
  requires an OPT 020 or the like.

- 'object doesn't understand this method'
  you invoke a method on a object that wasn't defined
  for its type.

- 'method doesn't have same #of args as method of baseclass'
  If you redefine a method, you have to make sure the new one
  has the same #of args as the original.

- 'too many register variables in this function'
  If you use :REG to assign register variables yourself,
  you can't use more than 5, currently.

- 'Linker can't find all symbols'
  If you use a module A that uses again a module B,
  B also needs to linked. A relies on certain PROCs to
  be present in B, and if B was recompiled with those
  PROCs removed, the linker has trouble putting your
  exe together.

- 'could not open "mathieeesingbas.library"'
  If you use float code, the compiler itself may need
  float functions to be able to generate code.

- 'illegal destructor definition'
  You defined an end() method with arguments (or with a returnvalue)

- 'implicit initialisation of private members'
  You write a [...] or NEW [...] expression that has private parts.

- 'double method declaration'
  You defined a method on this object twice.

- 'object referenced by other object not found'
  You probably inherited from some other object in another module, and
  then changed it (its name for example) without changing/recompiling
  other dependant modules too.

- 'unknown preprocessor keyword'
  only #define, #ifdef, #ifndef and #endif are known by EC's PP.

- 'illegal macro definition'
  You made a syntax error in typing your #define (see  17L )

- 'incoherent #ifdef/#ifndef nesting'
  You forgot to close with #endif or similar

- 'macro redefinition'
  You can't use the same macro-name-identifier twice.

- 'syntax error in #ifdef/#ifndef/#else/#endif'
  (see  17L  for the correct way to write conditionally compiled code)

- 'macro(s) nested too deep'
  You will get this if macros expand to other macros which expand to yet
  others... such that the amount of memory needed for this is getting
  out of hand. More likely you just defined a recursive macro (which will
  want to expand forever).

- 'method definition out of object/module scope'
  You can only define methods for an object in the same module/source
  where that object is defined.

- 'library definition problem'
  Generally when there's something wrong with the procs you specified in
  the LIBRARY declaration, i.e.: one doesn't exist, is not a PROC or is
  a method etc.

- 'object not known at this point'
  You are calling a method on an object whose type is not fully known
  at that point in the source. Better place the OBJECT at the top of
  your source.