diff --git a/include/flatcc/flatcc.h b/include/flatcc/flatcc.h index 04eb187f..4098690f 100644 --- a/include/flatcc/flatcc.h +++ b/include/flatcc/flatcc.h @@ -84,7 +84,7 @@ struct flatcc_options { int cgen_recursive; int cgen_spacing; int cgen_no_conflicts; - + int cgen; int bgen_bfbs; int bgen_qualify_names; diff --git a/src/cli/flatcc_cli.c b/src/cli/flatcc_cli.c index ee5b4038..7d57cc05 100644 --- a/src/cli/flatcc_cli.c +++ b/src/cli/flatcc_cli.c @@ -406,7 +406,7 @@ int main(int argc, const char *argv[]) { flatcc_options_t opts; flatcc_context_t ctx = 0; - int i, ret, cgen; + int i, ret; const char **src; ctx = 0; @@ -447,14 +447,15 @@ int main(int argc, const char *argv[]) ctx = 0; goto done; } - cgen = opts.cgen_reader || opts.cgen_builder || opts.cgen_verifier + opts.cgen = opts.cgen_reader || opts.cgen_builder || opts.cgen_verifier || opts.cgen_common_reader || opts.cgen_common_builder || opts.cgen_json_parser || opts.cgen_json_printer; - if (!opts.bgen_bfbs && (!cgen || opts.cgen_builder || opts.cgen_verifier)) { + if (!opts.bgen_bfbs && (!opts.cgen || opts.cgen_builder || opts.cgen_verifier)) { /* Assume default if no other output specified when deps required it. */ opts.cgen_reader = 1; + opts.cgen = 1; } - if (opts.bgen_bfbs && cgen) { + if (opts.bgen_bfbs && opts.cgen) { if (opts.gen_stdout) { fprintf(stderr, "--stdout cannot be used with mixed text and binary output\n"); goto fail; diff --git a/src/compiler/flatcc.c b/src/compiler/flatcc.c index e9fa0a1a..b55897d7 100644 --- a/src/compiler/flatcc.c +++ b/src/compiler/flatcc.c @@ -471,12 +471,19 @@ int flatcc_generate_files(flatcc_context_t ctx) } } #endif - +#ifdef PR216 + /* Note: P->opts.cgen now represents the below expression, and bfbs_gen is mutually exclusive with cgen */ if (!(P->opts.cgen_reader | P->opts.cgen_builder | P->opts.cgen_verifier | P->opts.cgen_common_reader | P->opts.cgen_common_builder | P->opts.cgen_json_parser | P->opts.cgen_json_printer)) { return 0; } +#else + /* Experimental alternative to PR216 */ + if (P->opts.bgen_bfbs) { + return 0; + } +#endif if (fb_init_output_c(out, &P->opts)) { return -1; }