[PPL-devel] [GIT] ppl/ppl(master): Move declarations to nsure variables are declared at smallest possible scope .

Patricia Hill p.m.hill at leeds.ac.uk
Tue Feb 21 22:44:07 CET 2012


Module: ppl/ppl
Branch: master
Commit: cb89844f83a5aa0591bece53a9ce517e9c807da1
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=cb89844f83a5aa0591bece53a9ce517e9c807da1

Author: Patricia Hill <p.m.hill at leeds.ac.uk>
Date:   Tue Feb 21 19:58:36 2012 +0000

Move declarations to nsure variables are declared at smallest possible scope.
Detected by ECLAIR service minscope.

---

 src/ppl-config.cc.in |   93 +++++++++++++++++++++++++------------------------
 1 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/src/ppl-config.cc.in b/src/ppl-config.cc.in
index b494a1f..005e712 100644
--- a/src/ppl-config.cc.in
+++ b/src/ppl-config.cc.in
@@ -100,10 +100,6 @@ Interface required_interface = NO_INTERFACE;
 std::string prefix;
 std::string exec_prefix;
 
-const char* variable_prefix = "PPL_";
-
-bool exec_prefix_set = false;
-
 bool required_application = false;
 bool required_library = false;
 bool required_prefix = false;
@@ -162,48 +158,6 @@ struct option long_options[] = {
 };
 #endif
 
-static const char* usage_string
-= "Usage: %s [OPTION]...\n"
-"Displays information, in various formats, about an installation\n"
-"of the Parma Polyhedra Library.\n\n"
-"Options:\n"
-"  -h, --help               prints this help text to stdout\n"
-"  -FFMT, --format=FMT      sets the output format to FMT\n"
-"                           (one of `plain', `makefile', `sh' or `csh')\n"
-"  -IINT, --interface=INT   selects a library interface (one of `C++', `C',\n"
-"                           `Ciao-Prolog', `GNU-Prolog', `SICStus-Prolog',\n"
-"                           `SWI-Prolog', `XSB-Prolog', `YAP-Prolog',\n"
-"                           `OCaml' or `Java')\n"
-"  -A, --application        selects output for building an application\n"
-"  -L, --library            selects output for building a library\n"
-"  -p[PFX], --prefix[=PFX]  prints or sets library prefix information\n"
-"  -e[PFX], --exec-prefix[=PFX]\n"
-"                           prints or sets library exec-prefix information\n"
-"  -O, --configure-options  prints configuration options\n"
-"  -V, --version            prints version information\n"
-"  -M, --version-major      prints version major number\n"
-"  -N, --version-minor      prints version minor number\n"
-"  -R, --version-revision   prints version revision number\n"
-"  -B, --version-beta       prints version beta number\n"
-"  -E, --banner             prints library banner\n"
-"  -n, --coefficients       prints type of library coefficients\n"
-"  -i, --includedir         prints include files directory\n"
-"  -b, --bindir             prints binary executables directory\n"
-"  -l, --libdir             prints library files directory\n"
-"  -P, --cppflags           prints preprocessor flags\n"
-"  -C, --cflags             prints C compiler flags\n"
-"  -X, --cxxflags           prints C++ compiler flags\n"
-"  -D, --ldflags            prints linker flags\n"
-"  -g, --license            prints synthetic licensing information\n"
-"  -c, --copying            prints detailed licensing information\n"
-"  -u, --bugs               prints bug reporting information\n"
-"  -r, --credits            prints credits\n"
-#ifndef PPL_HAVE_GETOPT_H
-"\n"
-"NOTE: this version does not support long options.\n"
-#endif
-"\n"
-"Report bugs to <ppl-devel at cs.unipr.it>.\n";
 
 #define OPTION_LETTERS "hF:I:ALp::e::OVMNRBEniblPCXDgcur"
 
@@ -256,6 +210,52 @@ strcaseeq(const char* s1, const char* s2) {
 
 void
 process_options(int argc, char* argv[]) {
+
+  bool exec_prefix_set = false;
+
+  static const char* usage_string
+  = "Usage: %s [OPTION]...\n"
+"Displays information, in various formats, about an installation\n"
+"of the Parma Polyhedra Library.\n\n"
+"Options:\n"
+"  -h, --help               prints this help text to stdout\n"
+"  -FFMT, --format=FMT      sets the output format to FMT\n"
+"                           (one of `plain', `makefile', `sh' or `csh')\n"
+"  -IINT, --interface=INT   selects a library interface (one of `C++', `C',\n"
+"                           `Ciao-Prolog', `GNU-Prolog', `SICStus-Prolog',\n"
+"                           `SWI-Prolog', `XSB-Prolog', `YAP-Prolog',\n"
+"                           `OCaml' or `Java')\n"
+"  -A, --application        selects output for building an application\n"
+"  -L, --library            selects output for building a library\n"
+"  -p[PFX], --prefix[=PFX]  prints or sets library prefix information\n"
+"  -e[PFX], --exec-prefix[=PFX]\n"
+"                           prints or sets library exec-prefix information\n"
+"  -O, --configure-options  prints configuration options\n"
+"  -V, --version            prints version information\n"
+"  -M, --version-major      prints version major number\n"
+"  -N, --version-minor      prints version minor number\n"
+"  -R, --version-revision   prints version revision number\n"
+"  -B, --version-beta       prints version beta number\n"
+"  -E, --banner             prints library banner\n"
+"  -n, --coefficients       prints type of library coefficients\n"
+"  -i, --includedir         prints include files directory\n"
+"  -b, --bindir             prints binary executables directory\n"
+"  -l, --libdir             prints library files directory\n"
+"  -P, --cppflags           prints preprocessor flags\n"
+"  -C, --cflags             prints C compiler flags\n"
+"  -X, --cxxflags           prints C++ compiler flags\n"
+"  -D, --ldflags            prints linker flags\n"
+"  -g, --license            prints synthetic licensing information\n"
+"  -c, --copying            prints detailed licensing information\n"
+"  -u, --bugs               prints bug reporting information\n"
+"  -r, --credits            prints credits\n"
+#ifndef PPL_HAVE_GETOPT_H
+"\n"
+"NOTE: this version does not support long options.\n"
+#endif
+"\n"
+"Report bugs to <ppl-devel at cs.unipr.it>.\n";
+
   while (true) {
 #ifdef PPL_HAVE_GETOPT_H
     int option_index = 0;
@@ -499,6 +499,7 @@ process_options(int argc, char* argv[]) {
 
 void
 portray_name(const char* name) {
+  const char* variable_prefix = "PPL_";
   switch (required_format) {
   case PLAIN:
     if (num_required_items > 1)




More information about the PPL-devel mailing list