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/430d20c9 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/430d20c9 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/430d20c9 Branch: refs/heads/compiler-warnings-20130314 Commit: 430d20c9f0e87cdc6f85d78dbd539c13fa0ccca5 Parents: a8a4a41 Author: Marvin Humphrey <[email protected]> Authored: Wed Mar 13 15:27:55 2013 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Thu Mar 14 13:51:09 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/430d20c9/clownfish/compiler/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c index f3e3d04..754f13f 100644 --- a/clownfish/compiler/common/charmonizer.c +++ b/clownfish/compiler/common/charmonizer.c @@ -1034,6 +1034,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> @@ -4674,6 +4700,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 @@ -4904,6 +4954,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/430d20c9/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/430d20c9/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";
