[Patch, C] options generation and language count

Joseph S. Myers joseph@codesourcery.com
Fri Sep 2 13:42:00 GMT 2011

On Thu, 1 Sep 2011, Gary Funck wrote:

> +# MAX_LANG is the maximum number of languages that can be defined.
> +# Its value is extracted from the value of CL_PARAMS in opts.h
> +# and is passed on the command line as '-v max_lang=...'.
> +if (n_langs > max_lang) {
> +  print "Error: the number of defined languages (" n_langs ") " \
> +        "exceeds the maximum supported by this implementation " \
> +	"(" max_lang ")" > "/dev/stderr"
> +  exit 2

Are you sure this /dev/stderr reference is portable?

I think this is trying to be too clever and you should just generate 
#if/#error in the output just like all the other error checks, and so not 
need to extract a value from a header with awk at all.

Joseph S. Myers

More information about the Gcc-patches mailing list