Make UNUSED_VAR macro available in CFC.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/e2036698 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/e2036698 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/e2036698 Branch: refs/heads/master Commit: e20366988a4e8b13f981d0f186968585b0d6c350 Parents: 88038e0 Author: Marvin Humphrey <[email protected]> Authored: Wed Mar 13 15:27:55 2013 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Fri Apr 5 14:05:54 2013 -0700 ---------------------------------------------------------------------- clownfish/compiler/common/charmonizer.c | 51 +++++++++++++++++++++++ clownfish/compiler/common/charmonizer.main | 1 + devel/bin/regen_charmonizer.pl | 2 +- 3 files changed, 53 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/e2036698/clownfish/compiler/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c index 6ef2e60..dfa4d91 100644 --- a/clownfish/compiler/common/charmonizer.c +++ b/clownfish/compiler/common/charmonizer.c @@ -1053,6 +1053,32 @@ void chaz_Strings_run(void); /***************************************************************************/ +#line 21 "src/Charmonizer/Probe/UnusedVars.h" +/* Charmonizer/Probe/UnusedVars.h + */ + +#ifndef H_CHAZ_UNUSED_VARS +#define H_CHAZ_UNUSED_VARS + +#include <stdio.h> + +/* Run the UnusedVars module. + * + * These symbols are exported: + * + * UNUSED_VAR(var) + * UNREACHABLE_RETURN(type) + * + */ +void chaz_UnusedVars_run(void); + +#endif /* H_CHAZ_UNUSED_VARS */ + + + + +/***************************************************************************/ + #line 17 "src/Charmonizer/Core/Compiler.c" #include <string.h> #include <stdlib.h> @@ -4746,6 +4772,30 @@ chaz_Strings_probe_c99_snprintf(void) { } +/***************************************************************************/ + +#line 17 "src/Charmonizer/Probe/UnusedVars.c" +/* #include "Charmonizer/Core/ConfWriter.h" */ +/* #include "Charmonizer/Core/Util.h" */ +/* #include "Charmonizer/Probe/UnusedVars.h" */ +#include <string.h> +#include <stdio.h> + + +void +chaz_UnusedVars_run(void) { + chaz_ConfWriter_start_module("UnusedVars"); + + /* Write the macros (no test, these are the same everywhere). */ + chaz_ConfWriter_add_def("UNUSED_VAR(x)", "((void)x)"); + chaz_ConfWriter_add_def("UNREACHABLE_RETURN(type)", "return (type)0"); + + chaz_ConfWriter_end_module(); +} + + + + #line 1 "clownfish/compiler/common/charmonizer.main" /* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -4976,6 +5026,7 @@ int main(int argc, const char **argv) { chaz_Headers_run(); chaz_Integers_run(); chaz_Strings_run(); + chaz_UnusedVars_run(); { int i; http://git-wip-us.apache.org/repos/asf/lucy/blob/e2036698/clownfish/compiler/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/clownfish/compiler/common/charmonizer.main b/clownfish/compiler/common/charmonizer.main index 7a7d262..a40dd74 100644 --- a/clownfish/compiler/common/charmonizer.main +++ b/clownfish/compiler/common/charmonizer.main @@ -227,6 +227,7 @@ int main(int argc, const char **argv) { chaz_Headers_run(); chaz_Integers_run(); chaz_Strings_run(); + chaz_UnusedVars_run(); { int i; http://git-wip-us.apache.org/repos/asf/lucy/blob/e2036698/devel/bin/regen_charmonizer.pl ---------------------------------------------------------------------- diff --git a/devel/bin/regen_charmonizer.pl b/devel/bin/regen_charmonizer.pl index a8c76ad..6f550cb 100755 --- a/devel/bin/regen_charmonizer.pl +++ b/devel/bin/regen_charmonizer.pl @@ -29,7 +29,7 @@ my $MELD_EXE = catfile( $CHAZ_DIR, 'buildbin', 'meld.pl' ); # Clownfish compiler. { - my $probes = "BuildEnv,DirManip,Headers,Integers,Strings"; + my $probes = "BuildEnv,DirManip,Headers,Integers,Strings,UnusedVars"; my $main = catfile(qw( clownfish compiler common charmonizer.main )); my $out = $main; $out =~ s/\.main/.c/ or die "no match";
