add: break; if (strncmp(arg, "-xdebugformat=", 14) == 0)
context: do_gcc(const char *dir, const char *cmd, int argc, char **argv,    struct aelist *h, int cplusplus){	int c;	int pic = 0;	int nolibc = 0;	char *model = NULL;	char *program;	size_t len = strlen(dir) + strlen(cmd) + 2;	program = malloc(len);	(void) snprintf(program, len, "%s/%s", dir, cmd);	/*	 * Basic defaults for ON compilation	 */	newae(h, program);	newae(h, "-fident");	newae(h, "-finline");	newae(h, "-fno-inline-functions");	newae(h, "-fno-builtin");	newae(h, "-fno-asm");	newae(h, "-nodefaultlibs");	/*	 * This is needed because 'u' is defined	 * under a conditional on 'sun'.  Should	 * probably just remove the conditional,	 * or make it be dependent on '__sun'.	 *	 * -Dunix is also missing in enhanced ANSI mode	 */	newae(h, "-D__sun");	/*	 * Walk the argument list, translating as we go ..	 */	while (--argc > 0) {		char *arg = *++argv;		size_t arglen = strlen(arg);		if (*arg == '-')			arglen--;		else {			/*			 * Discard inline files that gcc doesn't grok			 */			if (arglen > 3 &&			    strcmp(arg + arglen - 3, ".il") == 0)				continue;			/*			 * Otherwise, filenames, and partial arguments			 * are simply passed through for gcc to chew on.			 */			newae(h, arg);			continue;		}		if (cplusplus) {			if (strncmp(arg, "-compat=", 8) == 0) {				/* discard -compat=4 and -compat=5 */				continue;			}			if (strcmp(arg, "-Qoption") == 0) {				/* discard -Qoption and its two arguments */				if (argc < 3)					error(arg);				argc -= 2;				argv += 2;				continue;			}			if (strcmp(arg, "-xwe") == 0) {				/* turn warnings into errors */				/* newae(h, "-Werror"); */				continue;			}			if (strcmp(arg, "-noex") == 0) {				/* no exceptions */				newae(h, "-fno-exceptions");				/* no run time type descriptor information */				newae(h, "-fno-rtti");				continue;			}			if (strcmp(arg, "-pic") == 0) {				newae(h, "-fpic");				pic = 1;				continue;			}			if (strcmp(arg, "-PIC") == 0) {				newae(h, "-fPIC");				pic = 1;				continue;			}			if (strcmp(arg, "-norunpath") == 0) {				/* gcc has no corresponding option */				continue;			}			if (strcmp(arg, "-nolib") == 0) {				/* -nodefaultlibs is on by default */				nolibc = 1;				continue;			}#if defined(__sparc)			if (strcmp(arg, "-cg92") == 0) {				xlate(h, "v8", xarch_tbl);				xlate(h, "super", xchip_tbl);				continue;			}#endif	/* __sparc */		}		switch ((c = arg[1])) {		case '_':			if (strcmp(arg, "-_noecho") == 0)				echo = 0;			else if (strncmp(arg, "-_cc=", 5) == 0 ||			    strncmp(arg, "-_CC=", 5) == 0)				/* EMPTY */;			else if (strncmp(arg, "-_gcc=", 6) == 0 ||			    strncmp(arg, "-_g++=", 6) == 0)				newae(h, arg + 6);			else if (strcmp(arg, "-_compiler") == 0) {				(void) printf("%s\n", program);				exit(0);			} else				error(arg);			break;		case '#':			if (arglen == 1) {				newae(h, "-v");				break;			}			error(arg);			break;		case 'g':			newae(h, "-gdwarf-2");			break;		case 'E':			if (arglen == 1) {				newae(h, "-xc");				newae(h, arg);				nolibc = 1;				break;			}			error(arg);			break;		case 'c':		case 'S':			if (arglen == 1)				nolibc = 1;			/* FALLTHROUGH */		case 'C':		case 'H':		case 'p':			if (arglen == 1) {				newae(h, arg);				break;			}			error(arg);			break;		case 'A':		case 'h':		case 'I':		case 'i':		case 'L':		case 'l':		case 'o':		case 'R':		case 'U':		case 'u':		case 'w':			newae(h, arg);			break;		case 'D':			newae(h, arg);			/*			 * XXX	Clearly a hack ... do we need _KADB too?			 */			if (strcmp(arg, "-D_KERNEL") == 0 ||			    strcmp(arg, "-D_BOOT") == 0)				newae(h, "-ffreestanding");			break;		case 'd':			if (arglen == 2) {				if (strcmp(arg, "-dy") == 0) {					newae(h, "-Wl,-dy");					break;				}				if (strcmp(arg, "-dn") == 0) {					newae(h, "-Wl,-dn");					break;				}			}			if (strcmp(arg, "-dalign") == 0) {				/*				 * -dalign forces alignment in some cases;				 * gcc does not need any flag to do this.				 */				break;			}			error(arg);			break;		case 'e':			if (strcmp(arg,			    "-erroff=E_EMPTY_TRANSLATION_UNIT") == 0) {				/*				 * Accept but ignore this -- gcc doesn't				 * seem to complain about empty translation				 * units				 */				break;			}			/* XX64 -- ignore all -erroff= options, for now */			if (strncmp(arg, "-erroff=", 8) == 0)				break;			if (strcmp(arg, "-errtags=yes") == 0) {				warnings(h);				break;			}			if (strcmp(arg, "-errwarn=%all") == 0) {				newae(h, "-Werror");				break;			}			error(arg);			break;		case 'f':			if (strcmp(arg, "-flags") == 0) {				newae(h, "--help");				break;			}			error(arg);			break;		case 'G':			newae(h, "-shared");			nolibc = 1;			break;		case 'k':			if (strcmp(arg, "-keeptmp") == 0) {				newae(h, "-save-temps");				break;			}			error(arg);			break;		case 'K':			if (arglen == 1) {				if ((arg = *++argv) == NULL || *arg == '\0')					error("-K");				argc--;			} else {				arg += 2;			}			if (strcmp(arg, "pic") == 0) {				newae(h, "-fpic");				pic = 1;				break;			}			if (strcmp(arg, "PIC") == 0) {				newae(h, "-fPIC");				pic = 1;				break;			}			error("-K");			break;		case 'm':			if (strcmp(arg, "-mt") == 0) {				newae(h, "-D_REENTRANT");				break;			}			error(arg);			break;		case 'B':	/* linker options */		case 'M':		case 'z':			{				char *opt;				size_t len;				char *s;				if (arglen == 1) {					opt = *++argv;					if (opt == NULL || *opt == '\0')						error(arg);					argc--;				} else {					opt = arg + 2;				}				len = strlen(opt) + 7;				s = malloc(len);				(void) snprintf(s, len, "-Wl,-%c%s", c, opt);				newae(h, s);				free(s);			}			break;		case 'n':			if (strcmp(arg, "-noqueue") == 0) {				/*				 * Horrid license server stuff - n/a				 */				break;			}			error(arg);			break;		case 'O':			if (arglen == 1) {				newae(h, "-O");				break;			}			error(arg);			break;		case 'P':			/*			 * We could do '-E -o filename.i', but that's hard,			 * and we don't need it for the case that's triggering			 * this addition.  We'll require the user to specify			 * -o in the Makefile.  If they don't they'll find out			 * in a hurry.			 */			newae(h, "-E");			nolibc = 1;			break;		case 'q':			if (strcmp(arg, "-qp") == 0) {				newae(h, "-p");				break;			}			error(arg);			break;		case 's':			if (arglen == 1) {				newae(h, "-Wl,-s");				break;			}			error(arg);			break;		case 't':			if (arglen == 1) {				newae(h, "-Wl,-t");				break;			}			error(arg);			break;		case 'V':			if (arglen == 1) {				echo = 0;				newae(h, "--version");				break;			}			error(arg);			break;		case 'v':			if (arglen == 1) {				warnings(h);				break;			}			error(arg);			break;		case 'W':			if (strncmp(arg, "-Wp,-xc99", 9) == 0) {				/*				 * gcc's preprocessor will accept c99				 * regardless, so accept and ignore.				 */				break;			}			if (strncmp(arg, "-Wa,", 4) == 0 ||			    strncmp(arg, "-Wp,", 4) == 0 ||			    strncmp(arg, "-Wl,", 4) == 0) {				newae(h, arg);				break;			}			if (strcmp(arg, "-W0,-xc99=pragma") == 0) {				/* (undocumented) enables _Pragma */				break;			}			if (strcmp(arg, "-W0,-xc99=%none") == 0) {				/*				 * This is a polite way of saying				 * "no c99 constructs allowed!"				 * For now, just accept and ignore this.				 */				break;			}			if (strcmp(arg, "-W0,-noglobal") == 0) {				/*				 * gcc doesn't prefix local symbols				 * in debug mode, so this is not needed.				 */				break;			}			if (strcmp(arg, "-W0,-Lt") == 0) {				/*				 * Generate tests at the top of loops.				 * There is no direct gcc equivalent, ignore.				 */				break;			}			if (strcmp(arg, "-W2,-Rcond_elim") == 0) {				/*				 * Elimination and expansion of conditionals;				 * gcc has no direct equivalent.				 */				break;			}			if (strcmp(arg, "-Wd,-xsafe=unboundsym") == 0) {				/*				 * Prevents optimizing away checks for				 * unbound weak symbol addresses.  gcc does				 * not do this, so it's not needed.				 */				break;			}			if (strncmp(arg, "-Wc,-xcode=", 11) == 0) {				xlate(h, arg + 11, xcode_tbl);				if (strncmp(arg + 11, "pic", 3) == 0)					pic = 1;				break;			}			if (strncmp(arg, "-Wc,-Qiselect", 13) == 0) {				/*				 * Prevents insertion of register symbols.				 * gcc doesn't do this, so ignore it.				 */				break;			}#if defined(__x86)			if (strcmp(arg, "-Wu,-no_got_reloc") == 0) {				/*				 * Don't create any GOT relocations?				 * Well, gcc doesn't have this degree				 * of control over its pic code ...				 */				break;			}			if (strcmp(arg, "-Wu,-xmodel=kernel") == 0) {				newae(h, "-ffreestanding");				newae(h, "-mno-red-zone");				model = "-mcmodel=kernel";				nolibc = 1;				break;			}			if (strcmp(arg, "-Wu,-save_args") == 0) {				newae(h, "-msave-args");				break;			}#endif	/* __x86 */			error(arg);			break;		case 'X':			if (strcmp(arg, "-Xa") == 0 ||			    strcmp(arg, "-Xt") == 0) {				Xamode(h);				break;			}			if (strcmp(arg, "-Xc") == 0) {				Xcmode(h);				break;			}			if (strcmp(arg, "-Xs") == 0) {				Xsmode(h);				break;			}			error(arg);			break;		case 'x':			if (arglen == 1)				error(arg);			switch (arg[2]) {#if defined(__x86)			case '3':				if (strcmp(arg, "-x386") == 0) {					newae(h, "-march=i386");					break;				}				error(arg);				break;			case '4':				if (strcmp(arg, "-x486") == 0) {					newae(h, "-march=i486");					break;				}				error(arg);				break;#endif	/* __x86 */			case 'a':				if (strncmp(arg, "-xarch=", 7) == 0) {					xlate(h, arg + 7, xarch_tbl);					break;				}				error(arg);				break;			case 'C':				/* Accept C++ style comments -- ignore */				if (strcmp(arg, "-xCC") == 0)					break;				error(arg);				break;			case 'c':				if (strncmp(arg, "-xc99=%all", 10) == 0) {					newae(h, "-std=gnu99");					break;				}				if (strncmp(arg, "-xc99=%none", 11) == 0) {					newae(h, "-std=gnu89");					break;				}				if (strncmp(arg, "-xchip=", 7) == 0) {					xlate(h, arg + 7, xchip_tbl);					break;				}				if (strncmp(arg, "-xcode=", 7) == 0) {					xlate(h, arg + 7, xcode_tbl);					if (strncmp(arg + 7, "pic", 3) == 0)						pic = 1;					break;				}				if (strncmp(arg, "-xcache=", 8) == 0)					break;				if (strncmp(arg, "-xcrossfile", 11) == 0)					break;				error(arg);				break;			case 'd':				if (strcmp(arg, "-xdepend") == 0)					break;				error(arg);				break;			case 'F':				/* compile for mapfile reordering -- ignore */				if (strcmp(arg, "-xF") == 0)					break;				error(arg);				break;			case 'i':				if (strncmp(arg, "-xinline", 8) == 0)					/* No inlining; ignore */					break;				if (strcmp(arg, "-xildon") == 0 ||				    strcmp(arg, "-xildoff") == 0)					/* No incremental linking; ignore */					break;				error(arg);				break;			case 'M':				if (strcmp(arg, "-xM") == 0) {					newae(h, "-M");					break;				}				if (strcmp(arg, "-xM1") == 0) {					newae(h, "-MM");					break;				}				error(arg);				break;			case 'n':				if (strcmp(arg, "-xnolib") == 0) {					nolibc = 1;					break;				}				error(arg);				break;			case 'O':				if (strncmp(arg, "-xO", 3) == 0) {					size_t len = strlen(arg);					char *s = malloc(len);					int c = *(arg + 3);					int level;					if (len != 4 || !isdigit(c))						error(arg);					level = atoi(arg + 3);					if (level > 5)						error(arg);					if (level >= 2) {						/*						 * For gcc-3.4.x at -O2 we						 * need to disable optimizations						 * that break ON.						 */						optim_disable(h, level);						/*						 * limit -xO3 to -O2 as well.						 */						level = 2;					}					(void) snprintf(s, len, "-O%d", level);					newae(h, s);					free(s);					break;				}				error(arg);				break;			case 'p':				if (strcmp(arg, "-xpentium") == 0) {					newae(h, "-march=pentium");					break;				}				if (strcmp(arg, "-xpg") == 0) {					newae(h, "-pg");					break;				}				error(arg);				break;			case 'r':				if (strncmp(arg, "-xregs=", 7) == 0) {					xlate(h, arg + 7, xregs_tbl);					break;				}				error(arg);				break;			case 's':				if (strcmp(arg, "-xs") == 0 ||				    strcmp(arg, "-xspace") == 0 ||				    strcmp(arg, "-xstrconst") == 0)					break;				error(arg);				break;			case 't':				if (strcmp(arg, "-xtransition") == 0) {					newae(h, "-Wtransition");					break;				}				if (strcmp(arg, "-xtrigraphs=yes") == 0) {					newae(h, "-trigraphs");					break;				}				if (strcmp(arg, "-xtrigraphs=no") == 0) {					newae(h, "-notrigraphs");					break;				}				if (strncmp(arg, "-xtarget=", 9) == 0) {					xlate(h, arg + 9, xtarget_tbl);					break;				}				error(arg);				break;			case 'b':			case 'e':			case 'h':			case 'l':			default:				error(arg);				break;			}			break;		case 'Y':			if (arglen == 1) {				if ((arg = *++argv) == NULL || *arg == '\0')					error("-Y");				argc--;				arglen = strlen(arg + 1);			} else {				arg += 2;			}			/* Just ignore -YS,... for now */			if (strncmp(arg, "S,", 2) == 0)				break;			if (strncmp(arg, "l,", 2) == 0) {				char *s = strdup(arg);				s[0] = '-';				s[1] = 'B';				newae(h, s);				free(s);				break;			}			if (strncmp(arg, "I,", 2) == 0) {				char *s = strdup(arg);				s[0] = '-';				s[1] = 'I';				newae(h, "-nostdinc");				newae(h, s);				free(s);				break;			}			error(arg);			break;		case 'Q':			/*			 * We could map -Qy into -Wl,-Qy etc.			 */		default:			error(arg);			break;		}	}	if (model && !pic)		newae(h, model);	if (!nolibc)		newae(h, "-lc");}