drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y

Source file repositories/reference/linux-study-clean/drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y

File Facts

System
Linux kernel
Corpus path
drivers/scsi/aic7xxx/aicasm/aicasm_macro_gram.y
Extension
.y
Size
4031 bytes
Lines
163
Domain
Driver Families
Bucket
drivers/scsi
Inferred role
Driver Families: drivers/scsi
Status
atlas-only

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (macro_symbol->info.macroinfo->narg != $4) {
			printf("Narg == %d", macro_symbol->info.macroinfo->narg);
			stop("Too few arguments for macro invocation",
			     EX_DATAERR);
			/* NOTREACHED */
		}
		macro_symbol = NULL;
		YYACCEPT;
	}
;

macro_arglist:
	{
		/* Macros can take 0 arguments */
		$$ = 0;
	}
|	T_ARG
	{
		$$ = 1;
		add_macro_arg($1, 1);
	}
|	macro_arglist ',' T_ARG
	{
		if ($1 == 0) {
			stop("Comma without preceding argument in arg list",
			     EX_DATAERR);
			/* NOTREACHED */
		}
		$$ = $1 + 1;
		add_macro_arg($3, $$);
	}
;

%%

static void
add_macro_arg(const char *argtext, int argnum)
{
	struct macro_arg *marg;
	int i;

	if (macro_symbol == NULL || macro_symbol->type != MACRO) {
		stop("Invalid current symbol for adding macro arg",
		     EX_SOFTWARE);
		/* NOTREACHED */
	}
	/*
	 * Macro Invocation.  Find the appropriate argument and fill
	 * in the replace ment text for this call.
	 */
	i = 0;
	STAILQ_FOREACH(marg, &macro_symbol->info.macroinfo->args, links) {
		i++;
		if (i == argnum)
			break;
	}
	if (marg == NULL) {
		stop("Too many arguments for macro invocation", EX_DATAERR);
		/* NOTREACHED */
	}
	marg->replacement_text = strdup(argtext);
	if (marg->replacement_text == NULL) {
		stop("Unable to replicate replacement text", EX_SOFTWARE);
		/* NOTREACHED */
	}
}

void
mmerror(const char *string)
{

Annotation

Implementation Notes