Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-06-18 15:38:45

From: "Beman Dawes" <beman_at_[hidden]>

> I have written the first draft of a GNU bash script to test compilers
> against the boost libraries. It automatically generates an HTML
> table. For a very tentative example, see


There is no bash shell for the Mac. I'd be happy to rewrite the script in
Python, which is supported on all platforms I know of. Does this make any

> Don't take the results seriously; I am still debugging the script.
> I could use some help with these compilers:
> GNU GCC 2.95.2

I can test this one.

> Metrowerks Codewarrior 5.3

I am a CW beta tester, so my installations here (Mac and NT) have already
been upgraded to a beta of the next version. I would be happy to test with
that implementation, if Howard thinks it would be OK. I am not sure MW would
like me to reveal details of the beta, but I could perhaps post code tweaks
that will prevent us from having to revise the library code when the next
version of CW is released...

> Borland C++Builder 4
> Borland C++ 5.5
> The second question for each compiler is what standard library to test
> with? For VC++ I am testing both the vendor's library and STLport, since
> both are widely used with that compiler. I need advise on the others;
> Metrowerks for example supplies an excellent library so I'm not sure if it
> is worth testing that compiler with STLport. I'm always confused by
> library choices for the GNU compiler in particular.

The MW lib is indeed excellent, but many (?) people still use STLport with
CW in order to reduce platform dependencies. But if you decide to test with
STLport, there is the question of which version you are testing with. The
latest release version lags way behind the latest beta (in that it relies on
the underlying "native" lib implementation for iostream support), but some
people aren't comfortable using anything marked beta (not me, I'm a
bleeding-edge kinda guy). This is just as relevant for other compilers.

GCC 2.95.2 is supported by the lib it was released with (way non-conformant,
and buggy in places), and various others. In the SGI family it looks like
only the STLport is supporting this particular version of the compiler
(SGI's version supports GCC 2.8/egcs 1.1.2 according to docs). The release
version of the STLport uses gcc's outdated native iostream support, meaning
for example that there is no <sstream>. The beta version of the STLport
(derived from the SGI "experimental" iostreams library) is a full
implementation of the library, and supplies a very useful debugging mode
which supplies range and iterator validity checking. I know that somewhere
there exists a GNU effort to build a library based on the SGI library with
yet another string/iostream (?) implementation, but I've been unable to find

> Third question for each compiler is how do you tell if a compilation has
> errors? For VC++ I am grepping the output for "error" for lack of a
> way.

Emacs has a list of regular expressions called
compilation-error-regexp-alist, which seems to work pretty reliably and
looks like it's already been tuned for lots of compilers. I've appended its
default definition to this message.

> Once the script is running fairly reliably, I will post it so others can
> take it and modify it for other operating systems. The idea is that one
> two people will try out new releases for various operating systems, and
> email the generated table for me to add to the site.


(defvar compilation-error-regexp-alist
    ;; NOTE! See also grep-regexp-alist, below.

    ;; 4.3BSD grep, cc, lint pass 1:
    ;; /usr/src/foo/foo.c(8): warning: w may be used before set
    ;; or GNU utilities:
    ;; foo.c:8: error message
    ;; or HP-UX 7.0 fc:
    ;; foo.f :16 some horrible error message
    ;; or GNU utilities with column (GNAT 1.82):
    ;; foo.adb:2:1: Unit name does not match file name
    ;; or with column and program name:
    ;; jade:dbcommon.dsl:133:17:E: missing argument for function call
    ;; We'll insist that the number be followed by a colon or closing
    ;; paren, because otherwise this matches just about anything
    ;; containing a number with spaces around it.

    ;; We insist on a non-digit in the file name
    ;; so that we don't mistake the file name for a command name
    ;; and take the line number as the file name.
    ("\\([a-zA-Z][-a-zA-Z._0-9]+: ?\\)?\
\\([a-zA-Z]?:?[^:( \t\n]*[^:( \t\n0-9][^:( \t\n]*\\)[:(][ \t]*\\([0-9]+\\)\
\\([) \t]\\|:\\(\\([0-9]+:\\)\\|[0-9]*[^:0-9]\\)\\)" 2 3 6)

    ;; Microsoft C/C++:
    ;; keyboard.c(537) : warning C4005: 'min' : macro redefinition
    ;; d:\tmp\test.c(23) : error C2143: syntax error : missing ';' before
    ;; This used to be less selective and allow characters other than
    ;; parens around the line number, but that caused confusion for
    ;; GNU-style error messages.
    ;; This used to reject spaces and dashes in file names,
    ;; but they are valid now; so I made it more strict about the error
    ;; message that follows.
    ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \
: \\(error\\|warning\\) C[0-9]+:" 1 3)

    ;; Borland C++, C++Builder:
    ;; Error ping.c 15: Unable to open include file 'sys/types.h'
    ;; Warning ping.c 68: Call to function 'func' with no prototype
    ;; Error E2010 ping.c 15: Unable to open include file 'sys/types.h'
    ;; Warning W1022 ping.c 68: Call to function 'func' with no prototype
    ("\\(Error\\|Warning\\) \\(\\([FEW][0-9]+\\) \\)?\
\\([a-zA-Z]?:?[^:( \t\n]+\\)\
 \\([0-9]+\\)\\([) \t]\\|:[^0-9\n]\\)" 4 5)

    ;; 4.3BSD lint pass 2
    ;; strcmp: variable # of args. llib-lc(359) :: /usr/src/foo/foo.c(8)
    (".*[ \t:]\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(](+[ \t]*\\([0-9]+\\))[:)
     1 2)

    ;; 4.3BSD lint pass 3
    ;; bloofle defined( /users/wolfgang/foo.c(4) ), but never used
    ;; This used to be
    ;; ("[ \t(]+\\([a-zA-Z]?:?[^:( \t\n]+\\)[:( \t]+\\([0-9]+\\)[:) \t]+" 1
    ;; which is regexp Impressionism - it matches almost anything!
    (".*([ \t]*\\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\))" 1 2)

    ;; MIPS lint pass<n>; looks good for SunPro lint also
    ;; TrimMask (255) in solomon.c may be indistinguishable from TrimMasks
(93) in solomon.c due to truncation
    ("[^\n ]+ (\\([0-9]+\\)) in \\([^ \n]+\\)" 2 1)
    ;; name defined but never used: LinInt in cmap_calc.c(199)
    (".*in \\([^(\n]+\\)(\\([0-9]+\\))$" 1 2)

    ;; Ultrix 3.0 f77:
    ;; fort: Severe: addstf.f, line 82: Missing operator or delimiter
    ;; Some SGI cc version:
    ;; cfe: Warning 835: foo.c, line 2: something
    ("\\(cfe\\|fort\\): [^:\n]*: \\([^ \n]*\\), line \\([0-9]+\\):" 2 3)
    ;; Error on line 3 of t.f: Execution error unclassifiable statement
    ;; Unknown who does this:
    ;; Line 45 of "foo.c": bloofle undefined
    ;; Absoft FORTRAN 77 Compiler 3.1.3
    ;; error on line 19 of fplot.f: spelling error?
    ;; warning on line 17 of fplot.f: data type is undefined for variable d
    ("\\(.* on \\)?[Ll]ine[ \t]+\\([0-9]+\\)[ \t]+\
of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2)

    ;; Apollo cc, 4.3BSD fc:
    ;; "foo.f", line 3: Error: syntax error near end of statement
    ;; IBM RS6000:
    ;; "vvouch.c", line 19.5: 1506-046 (S) Syntax error.
    ;; Microtec mcc68k:
    ;; "foo.c", line 32 pos 1; (E) syntax error; unexpected symbol:
    ;; GNAT (as of July 94):
    ;; "foo.adb", line 2(11): warning: file name does not match ...
    ;; IBM AIX xlc compiler:
    ;; "src/swapping.c", line 30.34: 1506-342 (W) "/*" detected in comment.
    (".*\"\\([^,\" \n\t]+\\)\", lines? \
\\([0-9]+\\)\\([\(.]\\([0-9]+\\)\)?\\)?[:., (-]" 1 2 4)

    ;; Caml compiler:
    ;; File "", lines 5-8, characters 20-155: blah blah
   ("^File \"\\([^,\" \n\t]+\\)\", lines? \\([0-9]+\\)[-0-9]*, characters?
\\([0-9]+\\)" 1 2 3)

    ;; MIPS RISC CC - the one distributed with Ultrix:
    ;; ccom: Error: foo.c, line 2: syntax error
    ;; DEC AXP OSF/1 cc
    ;; /usr/lib/cmplrs/cc/cfe: Error: foo.c: 1: blah blah
    ("[a-z0-9/]+: \\([eE]rror\\|[wW]arning\\): \\([^,\" \n\t]+\\)[,:]
\\(line \\)?\\([0-9]+\\):" 2 4)

    ;; IBM AIX PS/2 C version 1.1:
    ;; ****** Error number 140 in line 8 of file errors.c ******
    (".*in line \\([0-9]+\\) of file \\([^ \n]+[^. \n]\\)\\.? " 2 1)
    ;; IBM AIX lint is too painful to do right this way. File name
    ;; prefixes entire sections rather than being on each line.

    ;; SPARCcompiler Pascal:
    ;; 20 linjer : array[1..4] of linje;
    ;; e 18480-----------^--- Inserted ';'
    ;; and
    ;; E 18520 line 61 - 0 is undefined
    ;; These messages don't contain a file name. Instead the compiler gives
    ;; a message whenever the file being compiled is changed.
    (" +\\([0-9]+\\) +.*\n[ew] [0-9]+-+" nil 1)
    ("[Ew] +[0-9]+ line \\([0-9]+\\) - " nil 1)

    ;; Lucid Compiler, lcc 3.x
    ;; E,,52) Illegal operation on pointers
    ("[EW], \\([^(\n]*\\)(\\([0-9]+\\),[ \t]*\\([0-9]+\\)" 1 2 3)

;;; This seems to be superfluous because the first pattern matches it.
;;; ;; GNU messages with program name and optional column number.
;;; ("[a-zA-Z]?:?[^0-9 \n\t:]+[^ \n\t:]*:[ \t]*\\([^ \n\t:]+\\):\
;;;\\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4)

    ;; Cray C compiler error messages
    ("\\(cc\\| cft\\)-[0-9]+ c\\(c\\|f77\\): ERROR \\([^,\n]+, \\)* File = \
\\([^,\n]+\\), Line = \\([0-9]+\\)" 4 5)

    ;; IBM C/C++ Tools 2.01:
    ;; foo.c(2:0) : informational EDC0804: Function foo is not referenced.
    ;; foo.c(3:8) : warning EDC0833: Implicit return statement encountered.
    ;; foo.c(5:5) : error EDC0350: Syntax error.
    ("\\([^( \n\t]+\\)(\\([0-9]+\\):\\([0-9]+\\)) : " 1 2 3)

    ;; IAR Systems C Compiler:
    ;; "foo.c",3 Error[32]: Error message
    ;; "foo.c",3 Warning[32]: Error message
    ("\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(Error\\|Warning\\)\\[[0-9]+\\]:" 1 2)

    ;; Sun ada (VADS, Solaris):
    ;; /home3/xdhar/rcds_rc/main.a, line 361, char 6:syntax error: ","
    ("\\([^, \n\t]+\\), line \\([0-9]+\\), char \\([0-9]+\\)[:., \(-]" 1 2

    ;; Perl -w:
    ;; syntax error at automake line 922, near "':'"
    (".* at \\([^ ]+\\) line \\([0-9]+\\)," 1 2)

    ;; Oracle pro*c:
    ;; Semantic error at line 528, column 5, file erosacqdb.pc:
    ("Semantic error at line \\([0-9]+\\), column \\([0-9]+\\), file
     3 1 2)

    ;; EPC F90 compiler:
    ;; Error 24 at (2:progran.f90) : syntax error
    ("Error [0-9]+ at (\\([0-9]*\\):\\([^)\n]+\\))" 2 1)

    ;; Sun F90 error messages:
    ;; cf90-113 f90comp: ERROR NSE, File = Hoved.f90, Line = 16, Column = 3
    (".* ERROR [a-zA-Z0-9 ]+, File = \\(.+\\), Line = \\([0-9]+\\), Column =
     1 2 3)
  "Alist that specifies how to match errors in compiler output.
If REGEXP matches, the FILE-IDX'th subexpression gives the file name, and
the LINE-IDX'th subexpression gives the line number. If COLUMN-IDX is
given, the COLUMN-IDX'th subexpression gives the column number on that line.
If any FILE-FORMAT is given, each is a format string to produce a file name
try; %s in the string is replaced by the text matching the FILE-IDX'th

Boost list run by bdawes at, gregod at, cpdaniel at, john at