From 3c1679cf361e3a919dcf70b7b73367d67caa65f8 Mon Sep 17 00:00:00 2001 From: midipix Date: Jun 23 2018 05:41:52 +0000 Subject: driver: added SLBT_MODE_INFO, for more elegant flow control. --- diff --git a/include/slibtool/slibtool.h b/include/slibtool/slibtool.h index 3502081..93982da 100644 --- a/include/slibtool/slibtool.h +++ b/include/slibtool/slibtool.h @@ -92,6 +92,7 @@ enum slbt_custom_error { /* execution modes */ enum slbt_mode { SLBT_MODE_UNKNOWN, + SLBT_MODE_INFO, SLBT_MODE_CLEAN, SLBT_MODE_COMPILE, SLBT_MODE_EXECUTE, diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c index 77c505a..2f08895 100644 --- a/src/driver/slbt_driver_ctx.c +++ b/src/driver/slbt_driver_ctx.c @@ -414,8 +414,9 @@ static int slbt_init_host_params( else base = cctx->cargv[0]; - if ((cctx->mode == SLBT_MODE_COMPILE) || (cctx->mode == SLBT_MODE_LINK)) - fdumpmachine = true; + fdumpmachine = (cctx->mode == SLBT_MODE_COMPILE) + || (cctx->mode == SLBT_MODE_LINK) + || (cctx->mode == SLBT_MODE_INFO); /* support the portbld <--> unknown synonym */ if (!(drvhost->machine = strdup(SLBT_MACHINE))) @@ -1164,6 +1165,10 @@ int slbt_get_driver_ctx( cctx.output = 0; } + /* info mode */ + if (cctx.drvflags & (SLBT_DRIVER_CONFIG | SLBT_DRIVER_FEATURES)) + cctx.mode = SLBT_MODE_INFO; + /* driver context */ if (!(ctx = slbt_driver_ctx_alloc(meta,&cctx))) return slbt_get_driver_ctx_fail(meta); @@ -1177,9 +1182,10 @@ int slbt_get_driver_ctx( ctx->cctx.cargv = sargv.cargv; /* host params */ - if ((cctx.drvflags & SLBT_DRIVER_HEURISTICS) - || (cctx.drvflags & SLBT_DRIVER_CONFIG) - || (cctx.mode != SLBT_MODE_COMPILE)) { + if (cctx.mode == SLBT_MODE_COMPILE) { + (void)0; + + } else { if (slbt_init_host_params( &ctx->cctx, &ctx->host, @@ -1187,10 +1193,11 @@ int slbt_get_driver_ctx( &ctx->cctx.cfgmeta)) { slbt_free_driver_ctx(&ctx->ctx); return -1; - } else - slbt_init_flavor_settings( - &ctx->cctx,0, - &ctx->cctx.settings); + } + + slbt_init_flavor_settings( + &ctx->cctx,0, + &ctx->cctx.settings); } /* ldpath */