You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by hc...@apache.org on 2014/11/18 10:02:42 UTC

[14/37] thrift git commit: THRIFT-2729: C++ - .clang-format created and applied

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/main.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/main.cc b/compiler/cpp/src/main.cc
old mode 100755
new mode 100644
index ed57596..57cd460
--- a/compiler/cpp/src/main.cc
+++ b/compiler/cpp/src/main.cc
@@ -40,7 +40,7 @@
 #include <limits.h>
 
 #ifdef _WIN32
-# include <windows.h> /* for GetFullPathName */
+#include <windows.h> /* for GetFullPathName */
 #endif
 
 // Careful: must include globals first for extern definitions
@@ -150,8 +150,8 @@ int g_doctext_lineno;
  * The First doctext comment
  */
 char* g_program_doctext_candidate;
-int  g_program_doctext_lineno = 0;
-PROGDOCTEXT_STATUS  g_program_doctext_status = INVALID;
+int g_program_doctext_lineno = 0;
+PROGDOCTEXT_STATUS g_program_doctext_status = INVALID;
 
 /**
  * Whether or not negative field keys are accepted.
@@ -172,12 +172,12 @@ bool gen_recurse = false;
  * Win32 doesn't have realpath, so use fallback implementation in that case,
  * otherwise this just calls through to realpath
  */
-char *saferealpath(const char *path, char *resolved_path) {
+char* saferealpath(const char* path, char* resolved_path) {
 #ifdef _WIN32
   char buf[MAX_PATH];
   char* basename;
   DWORD len = GetFullPathName(path, MAX_PATH, buf, &basename);
-  if (len == 0 || len > MAX_PATH - 1){
+  if (len == 0 || len > MAX_PATH - 1) {
     strcpy(resolved_path, path);
   } else {
     strcpy(resolved_path, buf);
@@ -197,14 +197,17 @@ char *saferealpath(const char *path, char *resolved_path) {
 #endif
 }
 
-bool check_is_directory(const char *dir_name) {
+bool check_is_directory(const char* dir_name) {
 #ifdef _WIN32
   DWORD attributes = ::GetFileAttributesA(dir_name);
-  if(attributes == INVALID_FILE_ATTRIBUTES) {
-    fprintf(stderr, "Output directory %s is unusable: GetLastError() = %ld\n", dir_name, GetLastError());
+  if (attributes == INVALID_FILE_ATTRIBUTES) {
+    fprintf(stderr,
+            "Output directory %s is unusable: GetLastError() = %ld\n",
+            dir_name,
+            GetLastError());
     return false;
   }
-  if((attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
+  if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
     fprintf(stderr, "Output directory %s exists but is not a directory\n", dir_name);
     return false;
   }
@@ -215,7 +218,7 @@ bool check_is_directory(const char *dir_name) {
     fprintf(stderr, "Output directory %s is unusable: %s\n", dir_name, strerror(errno));
     return false;
   }
-  if (! S_ISDIR(sb.st_mode)) {
+  if (!S_ISDIR(sb.st_mode)) {
     fprintf(stderr, "Output directory %s exists but is not a directory\n", dir_name);
     return false;
   }
@@ -233,11 +236,7 @@ bool check_is_directory(const char *dir_name) {
  */
 void yyerror(const char* fmt, ...) {
   va_list args;
-  fprintf(stderr,
-          "[ERROR:%s:%d] (last token was '%s')\n",
-          g_curpath.c_str(),
-          yylineno,
-          yytext);
+  fprintf(stderr, "[ERROR:%s:%d] (last token was '%s')\n", g_curpath.c_str(), yylineno, yytext);
 
   va_start(args, fmt);
   vfprintf(stderr, fmt, args);
@@ -316,7 +315,7 @@ void failure(const char* fmt, ...) {
 string program_name(string filename) {
   string::size_type slash = filename.rfind("/");
   if (slash != string::npos) {
-    filename = filename.substr(slash+1);
+    filename = filename.substr(slash + 1);
   }
   string::size_type dot = filename.rfind(".");
   if (dot != string::npos) {
@@ -400,25 +399,25 @@ void clear_doctext() {
  * Reset program doctext information after processing a file
  */
 void reset_program_doctext_info() {
-  if(g_program_doctext_candidate != NULL) {
+  if (g_program_doctext_candidate != NULL) {
     free(g_program_doctext_candidate);
     g_program_doctext_candidate = NULL;
   }
   g_program_doctext_lineno = 0;
   g_program_doctext_status = INVALID;
-  pdebug("%s","program doctext set to INVALID");
+  pdebug("%s", "program doctext set to INVALID");
 }
 
 /**
  * We are sure the program doctext candidate is really the program doctext.
  */
 void declare_valid_program_doctext() {
-  if((g_program_doctext_candidate != NULL) && (g_program_doctext_status == STILL_CANDIDATE)) {
+  if ((g_program_doctext_candidate != NULL) && (g_program_doctext_status == STILL_CANDIDATE)) {
     g_program_doctext_status = ABSOLUTELY_SURE;
-    pdebug("%s","program doctext set to ABSOLUTELY_SURE");
+    pdebug("%s", "program doctext set to ABSOLUTELY_SURE");
   } else {
     g_program_doctext_status = NO_PROGRAM_DOCTEXT;
-    pdebug("%s","program doctext set to NO_PROGRAM_DOCTEXT");
+    pdebug("%s", "program doctext set to NO_PROGRAM_DOCTEXT");
   }
 }
 
@@ -431,16 +430,14 @@ void declare_valid_program_doctext() {
 char* clean_up_doctext(char* doctext) {
   // Convert to C++ string, and remove Windows's carriage returns.
   string docstring = doctext;
-  docstring.erase(
-      remove(docstring.begin(), docstring.end(), '\r'),
-      docstring.end());
+  docstring.erase(remove(docstring.begin(), docstring.end(), '\r'), docstring.end());
 
   // Separate into lines.
   vector<string> lines;
   string::size_type pos = string::npos;
   string::size_type last;
   while (true) {
-    last = (pos == string::npos) ? 0 : pos+1;
+    last = (pos == string::npos) ? 0 : pos + 1;
     pos = docstring.find('\n', last);
     if (pos == string::npos) {
       // First bit of cleaning.  If the last line is only whitespace, drop it.
@@ -450,7 +447,7 @@ char* clean_up_doctext(char* doctext) {
       }
       break;
     }
-    lines.push_back(docstring.substr(last, pos-last));
+    lines.push_back(docstring.substr(last, pos - last));
   }
 
   // A very profound docstring.
@@ -468,7 +465,7 @@ char* clean_up_doctext(char* doctext) {
   bool found_prefix = false;
   string::size_type prefix_len = 0;
   vector<string>::iterator l_iter;
-  for (l_iter = lines.begin()+1; l_iter != lines.end(); ++l_iter) {
+  for (l_iter = lines.begin() + 1; l_iter != lines.end(); ++l_iter) {
     if (l_iter->empty()) {
       continue;
     }
@@ -487,9 +484,7 @@ char* clean_up_doctext(char* doctext) {
         // Whitespace-only line.  Truncate it.
         l_iter->clear();
       }
-    } else if (l_iter->size() > pos
-        && l_iter->at(pos) == '*'
-        && pos == prefix_len) {
+    } else if (l_iter->size() > pos && l_iter->at(pos) == '*' && pos == prefix_len) {
       // Business as usual.
     } else if (pos == string::npos) {
       // Whitespace-only line.  Let's truncate it for them.
@@ -505,27 +500,26 @@ char* clean_up_doctext(char* doctext) {
   if (have_prefix) {
     // Get the star too.
     prefix_len++;
-    for (l_iter = lines.begin()+1; l_iter != lines.end(); ++l_iter) {
+    for (l_iter = lines.begin() + 1; l_iter != lines.end(); ++l_iter) {
       l_iter->erase(0, prefix_len);
     }
   }
 
   // Now delete the minimum amount of leading whitespace from each line.
   prefix_len = string::npos;
-  for (l_iter = lines.begin()+1; l_iter != lines.end(); ++l_iter) {
+  for (l_iter = lines.begin() + 1; l_iter != lines.end(); ++l_iter) {
     if (l_iter->empty()) {
       continue;
     }
     pos = l_iter->find_first_not_of(" \t");
-    if (pos != string::npos
-        && (prefix_len == string::npos || pos < prefix_len)) {
+    if (pos != string::npos && (prefix_len == string::npos || pos < prefix_len)) {
       prefix_len = pos;
     }
   }
 
   // If our prefix survived, delete it from every line.
   if (prefix_len != string::npos) {
-    for (l_iter = lines.begin()+1; l_iter != lines.end(); ++l_iter) {
+    for (l_iter = lines.begin() + 1; l_iter != lines.end(); ++l_iter) {
       l_iter->erase(0, prefix_len);
     }
   }
@@ -533,8 +527,8 @@ char* clean_up_doctext(char* doctext) {
   // Remove trailing whitespace from every line.
   for (l_iter = lines.begin(); l_iter != lines.end(); ++l_iter) {
     pos = l_iter->find_last_not_of(" \t");
-    if (pos != string::npos && pos != l_iter->length()-1) {
-      l_iter->erase(pos+1);
+    if (pos != string::npos && pos != l_iter->length() - 1) {
+      l_iter->erase(pos + 1);
     }
   }
 
@@ -551,11 +545,11 @@ char* clean_up_doctext(char* doctext) {
     docstring += '\n';
   }
 
-  //assert(docstring.length() <= strlen(doctext));  may happen, see THRIFT-1755
-  if(docstring.length() <= strlen(doctext)) {
+  // assert(docstring.length() <= strlen(doctext));  may happen, see THRIFT-1755
+  if (docstring.length() <= strlen(doctext)) {
     strcpy(doctext, docstring.c_str());
   } else {
-    free(doctext);  // too short
+    free(doctext); // too short
     doctext = strdup(docstring.c_str());
   }
   return doctext;
@@ -661,20 +655,18 @@ void generate_all_fingerprints(t_program* program) {
   */
 }
 
-
 /**
  * Emits a warning on list<byte>, binary type is typically a much better choice.
  */
 void check_for_list_of_bytes(t_type* list_elem_type) {
-  if((g_parse_mode == PROGRAM) && (list_elem_type != NULL) && list_elem_type->is_base_type()) {
+  if ((g_parse_mode == PROGRAM) && (list_elem_type != NULL) && list_elem_type->is_base_type()) {
     t_base_type* tbase = (t_base_type*)list_elem_type;
-    if(tbase->get_base() == t_base_type::TYPE_BYTE) {
-      pwarning(1,"Consider using the more efficient \"binary\" type instead of \"list<byte>\".");
+    if (tbase->get_base() == t_base_type::TYPE_BYTE) {
+      pwarning(1, "Consider using the more efficient \"binary\" type instead of \"list<byte>\".");
     }
   }
 }
 
-
 /**
  * Prints the version number
  */
@@ -701,7 +693,7 @@ void help() {
   fprintf(stderr, "  -o dir      Set the output directory for gen-* packages\n");
   fprintf(stderr, "               (default: current directory)\n");
   fprintf(stderr, "  -out dir    Set the ouput location for generated files.\n");
-  fprintf(stderr,"               (no gen-* folder will be created)\n");
+  fprintf(stderr, "               (no gen-* folder will be created)\n");
   fprintf(stderr, "  -I dir      Add a directory to the list of directories\n");
   fprintf(stderr, "                searched for include directives\n");
   fprintf(stderr, "  -nowarn     Suppress all compiler warnings (BAD!)\n");
@@ -709,7 +701,8 @@ void help() {
   fprintf(stderr, "  -v[erbose]  Verbose mode\n");
   fprintf(stderr, "  -r[ecurse]  Also generate included files\n");
   fprintf(stderr, "  -debug      Parse debug trace to stdout\n");
-  fprintf(stderr, "  --allow-neg-keys  Allow negative field keys (Used to "
+  fprintf(stderr,
+          "  --allow-neg-keys  Allow negative field keys (Used to "
           "preserve protocol\n");
   fprintf(stderr, "                compatibility with older .thrift files)\n");
   fprintf(stderr, "  --allow-64bit-consts  Do not print warnings about using 64-bit constants\n");
@@ -723,9 +716,10 @@ void help() {
   t_generator_registry::gen_map_t gen_map = t_generator_registry::get_generator_map();
   t_generator_registry::gen_map_t::iterator iter;
   for (iter = gen_map.begin(); iter != gen_map.end(); ++iter) {
-    fprintf(stderr, "  %s (%s):\n",
-        iter->second->get_short_name().c_str(),
-        iter->second->get_long_name().c_str());
+    fprintf(stderr,
+            "  %s (%s):\n",
+            iter->second->get_short_name().c_str(),
+            iter->second->get_long_name().c_str());
     fprintf(stderr, "%s", iter->second->get_documentation().c_str());
   }
   exit(1);
@@ -778,8 +772,8 @@ void validate_const_rec(std::string name, t_type* type, t_const_value* value) {
       }
       break;
     case t_base_type::TYPE_DOUBLE:
-      if (value->get_type() != t_const_value::CV_INTEGER &&
-          value->get_type() != t_const_value::CV_DOUBLE) {
+      if (value->get_type() != t_const_value::CV_INTEGER
+          && value->get_type() != t_const_value::CV_DOUBLE) {
         throw "type error: const \"" + name + "\" was declared as double";
       }
       break;
@@ -805,9 +799,9 @@ void validate_const_rec(std::string name, t_type* type, t_const_value* value) {
       }
     }
     if (!found) {
-      throw "type error: const " + name + " was declared as type "
-        + type->get_name() + " which is an enum, but "
-        + value->get_identifier() + " is not a valid value for that enum";
+      throw "type error: const " + name + " was declared as type " + type->get_name()
+          + " which is an enum, but " + value->get_identifier()
+          + " is not a valid value for that enum";
     }
   } else if (type->is_struct() || type->is_xception()) {
     if (value->get_type() != t_const_value::CV_MAP) {
@@ -863,8 +857,8 @@ void validate_const_rec(std::string name, t_type* type, t_const_value* value) {
  * It's easier to do it this way instead of rewriting the whole grammar etc.
  */
 void validate_simple_identifier(const char* identifier) {
-  string name( identifier);
-  if( name.find(".") != string::npos) {
+  string name(identifier);
+  if (name.find(".") != string::npos) {
     yyerror("Identifier %s can't have a dot.", identifier);
     exit(1);
   }
@@ -904,9 +898,9 @@ bool validate_throws(t_struct* throws) {
 bool skip_utf8_bom(FILE* f) {
 
   // pretty straightforward, but works
-  if( fgetc(f) == 0xEF) {
-    if( fgetc(f) == 0xBB) {
-      if( fgetc(f) == 0xBF) {
+  if (fgetc(f) == 0xEF) {
+    if (fgetc(f) == 0xBB) {
+      if (fgetc(f) == 0xBF) {
         return true;
       }
     }
@@ -933,7 +927,7 @@ void parse(t_program* program, t_program* parent_program) {
   if (yyin == 0) {
     failure("Could not open input file: \"%s\"", path.c_str());
   }
-  if( skip_utf8_bom( yyin))
+  if (skip_utf8_bom(yyin))
     pverbose("Skipped UTF-8 BOM at %s\n", path.c_str());
 
   // Create new scope and scan for includes
@@ -975,7 +969,7 @@ void parse(t_program* program, t_program* parent_program) {
   if (yyin == 0) {
     failure("Could not open input file: \"%s\"", path.c_str());
   }
-  if( skip_utf8_bom( yyin))
+  if (skip_utf8_bom(yyin))
     pverbose("Skipped UTF-8 BOM at %s\n", path.c_str());
 
   pverbose("Parsing %s for types\n", path.c_str());
@@ -1010,7 +1004,7 @@ void generate(t_program* program, const vector<string>& generator_strings) {
     pverbose("Program: %s\n", program->get_path().c_str());
 
     // Compute fingerprints. - not anymore, we do it on the fly now
-    //generate_all_fingerprints(program);
+    // generate_all_fingerprints(program);
 
     if (dump_docs) {
       dump_docstrings(program);
@@ -1028,13 +1022,11 @@ void generate(t_program* program, const vector<string>& generator_strings) {
         delete generator;
       }
     }
-
   } catch (string s) {
     printf("Error: %s\n", s.c_str());
   } catch (const char* exc) {
     printf("Error: %s\n", exc);
   }
-
 }
 
 /**
@@ -1062,7 +1054,7 @@ int main(int argc, char** argv) {
   g_curpath = "arguments";
 
   // Hacky parameter handling... I didn't feel like using a library sorry!
-  for (i = 1; i < argc-1; i++) {
+  for (i = 1; i < argc - 1; i++) {
     char* arg;
 
     arg = strtok(argv[i], " ");
@@ -1084,9 +1076,9 @@ int main(int argc, char** argv) {
       } else if (strcmp(arg, "-strict") == 0) {
         g_strict = 255;
         g_warn = 2;
-      } else if (strcmp(arg, "-v") == 0 || strcmp(arg, "-verbose") == 0 ) {
+      } else if (strcmp(arg, "-v") == 0 || strcmp(arg, "-verbose") == 0) {
         g_verbose = 1;
-      } else if (strcmp(arg, "-r") == 0 || strcmp(arg, "-recurse") == 0 ) {
+      } else if (strcmp(arg, "-r") == 0 || strcmp(arg, "-recurse") == 0) {
         gen_recurse = true;
       } else if (strcmp(arg, "-allow-neg-keys") == 0) {
         g_allow_neg_field_keys = true;
@@ -1118,10 +1110,9 @@ int main(int argc, char** argv) {
         out_path = arg;
 
 #ifdef _WIN32
-        //strip out trailing \ on Windows
-        int last = out_path.length()-1;
-        if (out_path[last] == '\\')
-        {
+        // strip out trailing \ on Windows
+        int last = out_path.length() - 1;
+        if (out_path[last] == '\\') {
           out_path.erase(last);
         }
 #endif
@@ -1138,12 +1129,12 @@ int main(int argc, char** argv) {
   }
 
   // display help
-  if ((strcmp(argv[argc-1], "-help") == 0) || (strcmp(argv[argc-1], "--help") == 0)) {
+  if ((strcmp(argv[argc - 1], "-help") == 0) || (strcmp(argv[argc - 1], "--help") == 0)) {
     help();
   }
 
   // if you're asking for version, you have a right not to pass a file
-  if ((strcmp(argv[argc-1], "-version") == 0) || (strcmp(argv[argc-1], "--version") == 0)) {
+  if ((strcmp(argv[argc - 1], "-version") == 0) || (strcmp(argv[argc - 1], "--version") == 0)) {
     version();
     exit(0);
   }
@@ -1184,17 +1175,17 @@ int main(int argc, char** argv) {
   program->set_include_prefix(include_prefix);
 
   // Initialize global types
-  g_type_void   = new t_base_type("void",   t_base_type::TYPE_VOID);
+  g_type_void = new t_base_type("void", t_base_type::TYPE_VOID);
   g_type_string = new t_base_type("string", t_base_type::TYPE_STRING);
   g_type_binary = new t_base_type("string", t_base_type::TYPE_STRING);
   ((t_base_type*)g_type_binary)->set_binary(true);
-  g_type_slist  = new t_base_type("string", t_base_type::TYPE_STRING);
+  g_type_slist = new t_base_type("string", t_base_type::TYPE_STRING);
   ((t_base_type*)g_type_slist)->set_string_list(true);
-  g_type_bool   = new t_base_type("bool",   t_base_type::TYPE_BOOL);
-  g_type_byte   = new t_base_type("byte",   t_base_type::TYPE_BYTE);
-  g_type_i16    = new t_base_type("i16",    t_base_type::TYPE_I16);
-  g_type_i32    = new t_base_type("i32",    t_base_type::TYPE_I32);
-  g_type_i64    = new t_base_type("i64",    t_base_type::TYPE_I64);
+  g_type_bool = new t_base_type("bool", t_base_type::TYPE_BOOL);
+  g_type_byte = new t_base_type("byte", t_base_type::TYPE_BYTE);
+  g_type_i16 = new t_base_type("i16", t_base_type::TYPE_I16);
+  g_type_i32 = new t_base_type("i32", t_base_type::TYPE_I32);
+  g_type_i64 = new t_base_type("i64", t_base_type::TYPE_I64);
   g_type_double = new t_base_type("double", t_base_type::TYPE_DOUBLE);
 
   // Parse it!

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/main.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/main.h b/compiler/cpp/src/main.h
index 9b0f3f3..a4f81b3 100644
--- a/compiler/cpp/src/main.h
+++ b/compiler/cpp/src/main.h
@@ -29,9 +29,7 @@
  * Defined in the flex library
  */
 
-extern "C" {
-  int yylex(void);
-}
+extern "C" { int yylex(void); }
 
 int yyparse(void);
 
@@ -99,8 +97,8 @@ void check_for_list_of_bytes(t_type* list_elem_type);
  * Flex utilities
  */
 
-extern int   yylineno;
-extern char  yytext[];
+extern int yylineno;
+extern char yytext[];
 extern FILE* yyin;
 
 #endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/md5.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/md5.h b/compiler/cpp/src/md5.h
index 3baa4dc..3fbe498 100644
--- a/compiler/cpp/src/md5.h
+++ b/compiler/cpp/src/md5.h
@@ -27,7 +27,7 @@
 
   This code implements the MD5 Algorithm defined in RFC 1321, whose
   text is available at
-	http://www.ietf.org/rfc/rfc1321.txt
+    http://www.ietf.org/rfc/rfc1321.txt
   The code is derived from the text of the RFC, including the test suite
   (section A.5) but excluding the rest of Appendix A.  It does not include
   any code or documentation that is identified in the RFC as being
@@ -38,17 +38,17 @@
   that follows (in reverse chronological order):
 
   2002-04-13 lpd Removed support for non-ANSI compilers; removed
-	references to Ghostscript; clarified derivation from RFC 1321;
-	now handles byte order either statically or dynamically.
+    references to Ghostscript; clarified derivation from RFC 1321;
+    now handles byte order either statically or dynamically.
   1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
   1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
-	added conditionalization for C++ compilation from Martin
-	Purschke <pu...@bnl.gov>.
+    added conditionalization for C++ compilation from Martin
+    Purschke <pu...@bnl.gov>.
   1999-05-03 lpd Original version.
  */
 
 #ifndef md5_INCLUDED
-#  define md5_INCLUDED
+#define md5_INCLUDED
 
 /*
  * This package supports both compile-time and run-time determination of CPU
@@ -61,31 +61,30 @@
  */
 
 typedef unsigned char md5_byte_t; /* 8-bit byte */
-typedef unsigned int md5_word_t; /* 32-bit word */
+typedef unsigned int md5_word_t;  /* 32-bit word */
 
 /* Define the state of the MD5 Algorithm. */
 typedef struct md5_state_s {
-    md5_word_t count[2];	/* message length in bits, lsw first */
-    md5_word_t abcd[4];		/* digest buffer */
-    md5_byte_t buf[64];		/* accumulate block */
+  md5_word_t count[2]; /* message length in bits, lsw first */
+  md5_word_t abcd[4];  /* digest buffer */
+  md5_byte_t buf[64];  /* accumulate block */
 } md5_state_t;
 
 #ifdef __cplusplus
-extern "C"
-{
+extern "C" {
 #endif
 
 /* Initialize the algorithm. */
-void md5_init(md5_state_t *pms);
+void md5_init(md5_state_t* pms);
 
 /* Append a string to the message. */
-void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
+void md5_append(md5_state_t* pms, const md5_byte_t* data, int nbytes);
 
 /* Finish the message and return the digest. */
-void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
+void md5_finish(md5_state_t* pms, md5_byte_t digest[16]);
 
 #ifdef __cplusplus
-}  /* end extern "C" */
+} /* end extern "C" */
 #endif
 
 #endif /* md5_INCLUDED */

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/parse.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/parse.cc b/compiler/cpp/src/parse/parse.cc
index 0a0c2c0..7f94bab 100644
--- a/compiler/cpp/src/parse/parse.cc
+++ b/compiler/cpp/src/parse/parse.cc
@@ -24,7 +24,7 @@
 #include "main.h"
 
 void t_type::generate_fingerprint() {
-  if (! has_fingerprint()) {
+  if (!has_fingerprint()) {
     pdebug("generating fingerprint for %s", get_name().c_str());
     std::string material = get_fingerprint_material();
     md5_state_t ctx;

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_base_type.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_base_type.h b/compiler/cpp/src/parse/t_base_type.h
index d76772b..34ff961 100644
--- a/compiler/cpp/src/parse/t_base_type.h
+++ b/compiler/cpp/src/parse/t_base_type.h
@@ -29,7 +29,7 @@
  *
  */
 class t_base_type : public t_type {
- public:
+public:
   /**
    * Enumeration of thrift base types
    */
@@ -44,64 +44,34 @@ class t_base_type : public t_type {
     TYPE_DOUBLE
   };
 
-  t_base_type(std::string name, t_base base) :
-    t_type(name),
-    base_(base),
-    string_list_(false),
-    binary_(false),
-    string_enum_(false){}
+  t_base_type(std::string name, t_base base)
+    : t_type(name), base_(base), string_list_(false), binary_(false), string_enum_(false) {}
 
-  t_base get_base() const {
-    return base_;
-  }
+  t_base get_base() const { return base_; }
 
-  bool is_void() const {
-    return base_ == TYPE_VOID;
-  }
+  bool is_void() const { return base_ == TYPE_VOID; }
 
-  bool is_string() const {
-    return base_ == TYPE_STRING;
-  }
+  bool is_string() const { return base_ == TYPE_STRING; }
 
-  bool is_bool() const {
-    return base_ == TYPE_BOOL;
-  }
+  bool is_bool() const { return base_ == TYPE_BOOL; }
 
-  void set_string_list(bool val) {
-    string_list_ = val;
-  }
+  void set_string_list(bool val) { string_list_ = val; }
 
-  bool is_string_list() const {
-    return (base_ == TYPE_STRING) && string_list_;
-  }
+  bool is_string_list() const { return (base_ == TYPE_STRING) && string_list_; }
 
-  void set_binary(bool val) {
-    binary_ = val;
-  }
+  void set_binary(bool val) { binary_ = val; }
 
-  bool is_binary() const {
-    return (base_ == TYPE_STRING) && binary_;
-  }
+  bool is_binary() const { return (base_ == TYPE_STRING) && binary_; }
 
-  void set_string_enum(bool val) {
-    string_enum_ = val;
-  }
+  void set_string_enum(bool val) { string_enum_ = val; }
 
-  bool is_string_enum() const {
-    return base_ == TYPE_STRING && string_enum_;
-  }
+  bool is_string_enum() const { return base_ == TYPE_STRING && string_enum_; }
 
-  void add_string_enum_val(std::string val) {
-    string_enum_vals_.push_back(val);
-  }
+  void add_string_enum_val(std::string val) { string_enum_vals_.push_back(val); }
 
-  const std::vector<std::string>& get_string_enum_vals() const {
-    return string_enum_vals_;
-  }
+  const std::vector<std::string>& get_string_enum_vals() const { return string_enum_vals_; }
 
-  bool is_base_type() const {
-    return true;
-  }
+  bool is_base_type() const { return true; }
 
   virtual std::string get_fingerprint_material() const {
     std::string rv = t_base_name(base_);
@@ -113,19 +83,37 @@ class t_base_type : public t_type {
 
   static std::string t_base_name(t_base tbase) {
     switch (tbase) {
-      case TYPE_VOID   : return      "void"; break;
-      case TYPE_STRING : return    "string"; break;
-      case TYPE_BOOL   : return      "bool"; break;
-      case TYPE_BYTE   : return      "byte"; break;
-      case TYPE_I16    : return       "i16"; break;
-      case TYPE_I32    : return       "i32"; break;
-      case TYPE_I64    : return       "i64"; break;
-      case TYPE_DOUBLE : return    "double"; break;
-      default          : return "(unknown)"; break;
+    case TYPE_VOID:
+      return "void";
+      break;
+    case TYPE_STRING:
+      return "string";
+      break;
+    case TYPE_BOOL:
+      return "bool";
+      break;
+    case TYPE_BYTE:
+      return "byte";
+      break;
+    case TYPE_I16:
+      return "i16";
+      break;
+    case TYPE_I32:
+      return "i32";
+      break;
+    case TYPE_I64:
+      return "i64";
+      break;
+    case TYPE_DOUBLE:
+      return "double";
+      break;
+    default:
+      return "(unknown)";
+      break;
     }
   }
 
- private:
+private:
   t_base base_;
 
   bool string_list_;

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_const.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_const.h b/compiler/cpp/src/parse/t_const.h
index 7fd81bd..0f64bb1 100644
--- a/compiler/cpp/src/parse/t_const.h
+++ b/compiler/cpp/src/parse/t_const.h
@@ -31,29 +31,20 @@
  *
  */
 class t_const : public t_doc {
- public:
-  t_const(t_type* type, std::string name, t_const_value* value) :
-    type_(type),
-    name_(name),
-    value_(value) {}
+public:
+  t_const(t_type* type, std::string name, t_const_value* value)
+    : type_(type), name_(name), value_(value) {}
 
-  t_type* get_type() const {
-    return type_;
-  }
+  t_type* get_type() const { return type_; }
 
-  std::string get_name() const {
-    return name_;
-  }
+  std::string get_name() const { return name_; }
 
-  t_const_value* get_value() const {
-    return value_;
-  }
+  t_const_value* get_value() const { return value_; }
 
- private:
+private:
   t_type* type_;
   std::string name_;
   t_const_value* value_;
 };
 
 #endif
-

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_const_value.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_const_value.h b/compiler/cpp/src/parse/t_const_value.h
index ff422ae..7e6e3f6 100644
--- a/compiler/cpp/src/parse/t_const_value.h
+++ b/compiler/cpp/src/parse/t_const_value.h
@@ -32,35 +32,21 @@
  *
  */
 class t_const_value {
- public:
-
-  enum t_const_value_type {
-    CV_INTEGER,
-    CV_DOUBLE,
-    CV_STRING,
-    CV_MAP,
-    CV_LIST,
-    CV_IDENTIFIER
-  };
+public:
+  enum t_const_value_type { CV_INTEGER, CV_DOUBLE, CV_STRING, CV_MAP, CV_LIST, CV_IDENTIFIER };
 
   t_const_value() {}
 
-  t_const_value(int64_t val) {
-    set_integer(val);
-  }
+  t_const_value(int64_t val) { set_integer(val); }
 
-  t_const_value(std::string val) {
-    set_string(val);
-  }
+  t_const_value(std::string val) { set_string(val); }
 
   void set_string(std::string val) {
     valType_ = CV_STRING;
     stringVal_ = val;
   }
 
-  std::string get_string() const {
-    return stringVal_;
-  }
+  std::string get_string() const { return stringVal_; }
 
   void set_integer(int64_t val) {
     valType_ = CV_INTEGER;
@@ -75,13 +61,12 @@ class t_const_value {
       std::string identifier = get_identifier();
       std::string::size_type dot = identifier.rfind('.');
       if (dot != std::string::npos) {
-        identifier = identifier.substr(dot+1);
+        identifier = identifier.substr(dot + 1);
       }
       t_enum_value* val = enum_->get_constant_by_name(identifier);
       if (val == NULL) {
-        throw
-          "Unable to find enum value \"" + identifier +
-          "\" in enum \"" + enum_->get_name() + "\"";
+        throw "Unable to find enum value \"" + identifier + "\" in enum \"" + enum_->get_name()
+            + "\"";
       }
       return val->get_value();
     } else {
@@ -94,42 +79,26 @@ class t_const_value {
     doubleVal_ = val;
   }
 
-  double get_double() const {
-    return doubleVal_;
-  }
+  double get_double() const { return doubleVal_; }
 
-  void set_map() {
-    valType_ = CV_MAP;
-  }
+  void set_map() { valType_ = CV_MAP; }
 
-  void add_map(t_const_value* key, t_const_value* val) {
-    mapVal_[key] = val;
-  }
+  void add_map(t_const_value* key, t_const_value* val) { mapVal_[key] = val; }
 
-  const std::map<t_const_value*, t_const_value*>& get_map() const {
-    return mapVal_;
-  }
+  const std::map<t_const_value*, t_const_value*>& get_map() const { return mapVal_; }
 
-  void set_list() {
-    valType_ = CV_LIST;
-  }
+  void set_list() { valType_ = CV_LIST; }
 
-  void add_list(t_const_value* val) {
-    listVal_.push_back(val);
-  }
+  void add_list(t_const_value* val) { listVal_.push_back(val); }
 
-  const std::vector<t_const_value*>& get_list() const {
-    return listVal_;
-  }
+  const std::vector<t_const_value*>& get_list() const { return listVal_; }
 
   void set_identifier(std::string val) {
     valType_ = CV_IDENTIFIER;
     identifierVal_ = val;
   }
 
-  std::string get_identifier() const {
-    return identifierVal_;
-  }
+  std::string get_identifier() const { return identifierVal_; }
 
   std::string get_identifier_name() const {
     std::string ret = get_identifier();
@@ -137,10 +106,10 @@ class t_const_value {
     if (s == std::string::npos) {
       throw "error: identifier " + ret + " is unqualified!";
     }
-    ret = ret.substr(s+1);
+    ret = ret.substr(s + 1);
     s = ret.find('.');
     if (s != std::string::npos) {
-      ret = ret.substr(s+1);
+      ret = ret.substr(s + 1);
     }
     return ret;
   }
@@ -151,22 +120,18 @@ class t_const_value {
     if (s == std::string::npos) {
       throw "error: identifier " + ret + " is unqualified!";
     }
-    size_t s2 = ret.find('.', s+1);
+    size_t s2 = ret.find('.', s + 1);
     if (s2 != std::string::npos) {
-      ret = ret.substr(s+1);
+      ret = ret.substr(s + 1);
     }
     return ret;
   }
 
-  void set_enum(t_enum* tenum) {
-    enum_ = tenum;
-  }
+  void set_enum(t_enum* tenum) { enum_ = tenum; }
 
-  t_const_value_type get_type() const {
-    return valType_;
-  }
+  t_const_value_type get_type() const { return valType_; }
 
- private:
+private:
   std::map<t_const_value*, t_const_value*> mapVal_;
   std::vector<t_const_value*> listVal_;
   std::string stringVal_;
@@ -176,8 +141,6 @@ class t_const_value {
   t_enum* enum_;
 
   t_const_value_type valType_;
-
 };
 
 #endif
-

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_container.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_container.h b/compiler/cpp/src/parse/t_container.h
index 6753493..0d992b7 100644
--- a/compiler/cpp/src/parse/t_container.h
+++ b/compiler/cpp/src/parse/t_container.h
@@ -23,10 +23,8 @@
 #include "t_type.h"
 
 class t_container : public t_type {
- public:
-  t_container() :
-    cpp_name_(),
-    has_cpp_name_(false) {}
+public:
+  t_container() : cpp_name_(), has_cpp_name_(false) {}
 
   virtual ~t_container() {}
 
@@ -35,22 +33,15 @@ class t_container : public t_type {
     has_cpp_name_ = true;
   }
 
-  bool has_cpp_name() {
-    return has_cpp_name_;
-  }
+  bool has_cpp_name() { return has_cpp_name_; }
 
-  std::string get_cpp_name() {
-    return cpp_name_;
-  }
+  std::string get_cpp_name() { return cpp_name_; }
 
-  bool is_container() const {
-    return true;
-  }
+  bool is_container() const { return true; }
 
- private:
+private:
   std::string cpp_name_;
   bool has_cpp_name_;
-
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_doc.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_doc.h b/compiler/cpp/src/parse/t_doc.h
index 2c63b5a..9d310b7 100644
--- a/compiler/cpp/src/parse/t_doc.h
+++ b/compiler/cpp/src/parse/t_doc.h
@@ -29,30 +29,26 @@
  */
 class t_doc {
 
- public:
+public:
   t_doc() : has_doc_(false) {}
 
   void set_doc(const std::string& doc) {
     doc_ = doc;
     has_doc_ = true;
-    if( (g_program_doctext_lineno == g_doctext_lineno) &&  (g_program_doctext_status == STILL_CANDIDATE)) {
+    if ((g_program_doctext_lineno == g_doctext_lineno)
+        && (g_program_doctext_status == STILL_CANDIDATE)) {
       g_program_doctext_status = ALREADY_PROCESSED;
-      pdebug("%s","program doctext set to ALREADY_PROCESSED");
+      pdebug("%s", "program doctext set to ALREADY_PROCESSED");
     }
   }
 
-  const std::string& get_doc() const {
-    return doc_;
-  }
+  const std::string& get_doc() const { return doc_; }
 
-  bool has_doc() {
-    return has_doc_;
-  }
+  bool has_doc() { return has_doc_; }
 
- private:
+private:
   std::string doc_;
   bool has_doc_;
-
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_enum.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_enum.h b/compiler/cpp/src/parse/t_enum.h
index 94cb26e..59941e3 100644
--- a/compiler/cpp/src/parse/t_enum.h
+++ b/compiler/cpp/src/parse/t_enum.h
@@ -28,21 +28,14 @@
  *
  */
 class t_enum : public t_type {
- public:
-  t_enum(t_program* program) :
-    t_type(program) {}
+public:
+  t_enum(t_program* program) : t_type(program) {}
 
-  void set_name(const std::string& name) {
-    name_ = name;
-  }
+  void set_name(const std::string& name) { name_ = name; }
 
-  void append(t_enum_value* constant) {
-    constants_.push_back(constant);
-  }
+  void append(t_enum_value* constant) { constants_.push_back(constant); }
 
-  const std::vector<t_enum_value*>& get_constants() {
-    return constants_;
-  }
+  const std::vector<t_enum_value*>& get_constants() { return constants_; }
 
   t_enum_value* get_constant_by_name(const std::string name) {
     const std::vector<t_enum_value*>& enum_values = get_constants();
@@ -72,8 +65,7 @@ class t_enum : public t_type {
     t_enum_value* min_value;
     if (enum_values.size() == 0) {
       min_value = NULL;
-    }
-    else {
+    } else {
       int min_value_value;
       min_value = enum_values.front();
       min_value_value = min_value->get_value();
@@ -93,8 +85,7 @@ class t_enum : public t_type {
     t_enum_value* max_value;
     if (enum_values.size() == 0) {
       max_value = NULL;
-    }
-    else {
+    } else {
       int max_value_value;
       max_value = enum_values.back();
       max_value_value = max_value->get_value();
@@ -108,16 +99,11 @@ class t_enum : public t_type {
     return max_value;
   }
 
-  bool is_enum() const {
-    return true;
-  }
-
-  virtual std::string get_fingerprint_material() const {
-    return "enum";
-  }
+  bool is_enum() const { return true; }
 
+  virtual std::string get_fingerprint_material() const { return "enum"; }
 
- private:
+private:
   std::vector<t_enum_value*> constants_;
 };
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_enum_value.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_enum_value.h b/compiler/cpp/src/parse/t_enum_value.h
index 26798d7..5979f06 100644
--- a/compiler/cpp/src/parse/t_enum_value.h
+++ b/compiler/cpp/src/parse/t_enum_value.h
@@ -30,24 +30,18 @@
  *
  */
 class t_enum_value : public t_doc {
- public:
-  t_enum_value(std::string name, int value) :
-    name_(name),
-    value_(value) {}
+public:
+  t_enum_value(std::string name, int value) : name_(name), value_(value) {}
 
   ~t_enum_value() {}
 
-  const std::string& get_name() const {
-    return name_;
-  }
+  const std::string& get_name() const { return name_; }
 
-  int get_value() const {
-    return value_;
-  }
+  int get_value() const { return value_; }
 
   std::map<std::string, std::string> annotations_;
 
- private:
+private:
   std::string name_;
   int value_;
 };

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_field.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_field.h b/compiler/cpp/src/parse/t_field.h
index c05fdf3..c4e30e3 100644
--- a/compiler/cpp/src/parse/t_field.h
+++ b/compiler/cpp/src/parse/t_field.h
@@ -34,96 +34,65 @@ class t_struct;
  *
  */
 class t_field : public t_doc {
- public:
-  t_field(t_type* type, std::string name) :
-    type_(type),
-    name_(name),
-    key_(0),
-    value_(NULL),
-    xsd_optional_(false),
-    xsd_nillable_(false),
-    xsd_attrs_(NULL),
-    reference_(false) {}
-
-  t_field(t_type* type, std::string name, int32_t key) :
-    type_(type),
-    name_(name),
-    key_(key),
-    req_(T_OPT_IN_REQ_OUT),
-    value_(NULL),
-    xsd_optional_(false),
-    xsd_nillable_(false),
-    xsd_attrs_(NULL),
-    reference_(false) {}
+public:
+  t_field(t_type* type, std::string name)
+    : type_(type),
+      name_(name),
+      key_(0),
+      value_(NULL),
+      xsd_optional_(false),
+      xsd_nillable_(false),
+      xsd_attrs_(NULL),
+      reference_(false) {}
+
+  t_field(t_type* type, std::string name, int32_t key)
+    : type_(type),
+      name_(name),
+      key_(key),
+      req_(T_OPT_IN_REQ_OUT),
+      value_(NULL),
+      xsd_optional_(false),
+      xsd_nillable_(false),
+      xsd_attrs_(NULL),
+      reference_(false) {}
 
   ~t_field() {}
 
-  t_type* get_type() const {
-    return type_;
-  }
+  t_type* get_type() const { return type_; }
 
-  const std::string& get_name() const {
-    return name_;
-  }
+  const std::string& get_name() const { return name_; }
 
-  int32_t get_key() const {
-    return key_;
-  }
+  int32_t get_key() const { return key_; }
 
-  enum e_req {
-    T_REQUIRED,
-    T_OPTIONAL,
-    T_OPT_IN_REQ_OUT
-  };
+  enum e_req { T_REQUIRED, T_OPTIONAL, T_OPT_IN_REQ_OUT };
 
-  void set_req(e_req req) {
-    req_ = req;
-  }
+  void set_req(e_req req) { req_ = req; }
 
-  e_req get_req() const {
-    return req_;
-  }
+  e_req get_req() const { return req_; }
 
-  void set_value(t_const_value* value) {
-    value_ = value;
-  }
+  void set_value(t_const_value* value) { value_ = value; }
 
-  t_const_value* get_value() {
-    return value_;
-  }
+  t_const_value* get_value() { return value_; }
 
-  void set_xsd_optional(bool xsd_optional) {
-    xsd_optional_ = xsd_optional;
-  }
+  void set_xsd_optional(bool xsd_optional) { xsd_optional_ = xsd_optional; }
 
-  bool get_xsd_optional() const {
-    return xsd_optional_;
-  }
+  bool get_xsd_optional() const { return xsd_optional_; }
 
-  void set_xsd_nillable(bool xsd_nillable) {
-    xsd_nillable_ = xsd_nillable;
-  }
+  void set_xsd_nillable(bool xsd_nillable) { xsd_nillable_ = xsd_nillable; }
 
-  bool get_xsd_nillable() const {
-    return xsd_nillable_;
-  }
+  bool get_xsd_nillable() const { return xsd_nillable_; }
 
-  void set_xsd_attrs(t_struct* xsd_attrs) {
-    xsd_attrs_ = xsd_attrs;
-  }
+  void set_xsd_attrs(t_struct* xsd_attrs) { xsd_attrs_ = xsd_attrs; }
 
-  t_struct* get_xsd_attrs() {
-    return xsd_attrs_;
-  }
+  t_struct* get_xsd_attrs() { return xsd_attrs_; }
 
   // This is not the same function as t_type::get_fingerprint_material,
   // but it does the same thing.
   std::string get_fingerprint_material() const {
     std::ostringstream keystm;
     keystm << key_;
-    return keystm.str() + ":" +
-      ((req_ == T_OPTIONAL) ? "opt-" : "") +
-      type_->get_fingerprint_material();
+    return keystm.str() + ":" + ((req_ == T_OPTIONAL) ? "opt-" : "")
+           + type_->get_fingerprint_material();
   }
 
   /**
@@ -132,22 +101,18 @@ class t_field : public t_doc {
    * The arguments are (const) references to const pointers to const t_fields.
    */
   struct key_compare {
-    bool operator()(t_field const * const & a, t_field const * const & b) {
+    bool operator()(t_field const* const& a, t_field const* const& b) {
       return a->get_key() < b->get_key();
     }
   };
 
   std::map<std::string, std::string> annotations_;
 
-  bool get_reference() {
-    return reference_;
-  }
+  bool get_reference() { return reference_; }
 
-  void set_reference(bool reference) {
-    reference_ = reference;
-  }
+  void set_reference(bool reference) { reference_ = reference; }
 
- private:
+private:
   t_type* type_;
   std::string name_;
   int32_t key_;

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_function.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_function.h b/compiler/cpp/src/parse/t_function.h
index ae8c2f6..96886f3 100644
--- a/compiler/cpp/src/parse/t_function.h
+++ b/compiler/cpp/src/parse/t_function.h
@@ -32,17 +32,11 @@
  *
  */
 class t_function : public t_doc {
- public:
-  t_function(t_type* returntype,
-             std::string name,
-             t_struct* arglist,
-             bool oneway=false) :
-    returntype_(returntype),
-    name_(name),
-    arglist_(arglist),
-    oneway_(oneway) {
+public:
+  t_function(t_type* returntype, std::string name, t_struct* arglist, bool oneway = false)
+    : returntype_(returntype), name_(name), arglist_(arglist), oneway_(oneway) {
     xceptions_ = new t_struct(NULL);
-    if (oneway_ && (! returntype_->is_void())) {
+    if (oneway_ && (!returntype_->is_void())) {
       pwarning(1, "Oneway methods should return void.\n");
     }
   }
@@ -51,46 +45,35 @@ class t_function : public t_doc {
              std::string name,
              t_struct* arglist,
              t_struct* xceptions,
-             bool oneway=false) :
-    returntype_(returntype),
-    name_(name),
-    arglist_(arglist),
-    xceptions_(xceptions),
-    oneway_(oneway)
-  {
+             bool oneway = false)
+    : returntype_(returntype),
+      name_(name),
+      arglist_(arglist),
+      xceptions_(xceptions),
+      oneway_(oneway) {
     if (oneway_ && !xceptions_->get_members().empty()) {
       throw std::string("Oneway methods can't throw exceptions.");
     }
-    if (oneway_ && (! returntype_->is_void())) {
+    if (oneway_ && (!returntype_->is_void())) {
       pwarning(1, "Oneway methods should return void.\n");
     }
   }
 
   ~t_function() {}
 
-  t_type* get_returntype() const {
-    return returntype_;
-  }
+  t_type* get_returntype() const { return returntype_; }
 
-  const std::string& get_name() const {
-    return name_;
-  }
+  const std::string& get_name() const { return name_; }
 
-  t_struct* get_arglist() const {
-    return arglist_;
-  }
+  t_struct* get_arglist() const { return arglist_; }
 
-  t_struct* get_xceptions() const {
-    return xceptions_;
-  }
+  t_struct* get_xceptions() const { return xceptions_; }
 
-  bool is_oneway() const {
-    return oneway_;
-  }
+  bool is_oneway() const { return oneway_; }
 
   std::map<std::string, std::string> annotations_;
 
- private:
+private:
   t_type* returntype_;
   std::string name_;
   t_struct* arglist_;

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_list.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_list.h b/compiler/cpp/src/parse/t_list.h
index 21a9625..e121d1d 100644
--- a/compiler/cpp/src/parse/t_list.h
+++ b/compiler/cpp/src/parse/t_list.h
@@ -27,17 +27,12 @@
  *
  */
 class t_list : public t_container {
- public:
-  t_list(t_type* elem_type) :
-    elem_type_(elem_type) {}
+public:
+  t_list(t_type* elem_type) : elem_type_(elem_type) {}
 
-  t_type* get_elem_type() const {
-    return elem_type_;
-  }
+  t_type* get_elem_type() const { return elem_type_; }
 
-  bool is_list() const {
-    return true;
-  }
+  bool is_list() const { return true; }
 
   virtual std::string get_fingerprint_material() const {
     return "list<" + elem_type_->get_fingerprint_material() + ">";
@@ -48,9 +43,8 @@ class t_list : public t_container {
     elem_type_->generate_fingerprint();
   }
 
- private:
+private:
   t_type* elem_type_;
 };
 
 #endif
-

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_map.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_map.h b/compiler/cpp/src/parse/t_map.h
index c4e358f..4795147 100644
--- a/compiler/cpp/src/parse/t_map.h
+++ b/compiler/cpp/src/parse/t_map.h
@@ -28,26 +28,18 @@
  *
  */
 class t_map : public t_container {
- public:
-  t_map(t_type* key_type, t_type* val_type) :
-    key_type_(key_type),
-    val_type_(val_type) {}
+public:
+  t_map(t_type* key_type, t_type* val_type) : key_type_(key_type), val_type_(val_type) {}
 
-  t_type* get_key_type() const {
-    return key_type_;
-  }
+  t_type* get_key_type() const { return key_type_; }
 
-  t_type* get_val_type() const {
-    return val_type_;
-  }
+  t_type* get_val_type() const { return val_type_; }
 
-  bool is_map() const {
-    return true;
-  }
+  bool is_map() const { return true; }
 
   virtual std::string get_fingerprint_material() const {
-    return "map<" + key_type_->get_fingerprint_material() +
-      "," + val_type_->get_fingerprint_material() + ">";
+    return "map<" + key_type_->get_fingerprint_material() + ","
+           + val_type_->get_fingerprint_material() + ">";
   }
 
   virtual void generate_fingerprint() {
@@ -56,7 +48,7 @@ class t_map : public t_container {
     val_type_->generate_fingerprint();
   }
 
- private:
+private:
   t_type* key_type_;
   t_type* val_type_;
 };

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_program.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_program.h b/compiler/cpp/src/parse/t_program.h
index d18cc5d..51157aa 100644
--- a/compiler/cpp/src/parse/t_program.h
+++ b/compiler/cpp/src/parse/t_program.h
@@ -56,30 +56,22 @@
  *
  */
 class t_program : public t_doc {
- public:
-  t_program(std::string path, std::string name) :
-    path_(path),
-    name_(name),
-    out_path_("./"),
-    out_path_is_absolute_(false) {
+public:
+  t_program(std::string path, std::string name)
+    : path_(path), name_(name), out_path_("./"), out_path_is_absolute_(false) {
     scope_ = new t_scope();
   }
 
-  t_program(std::string path) :
-    path_(path),
-    out_path_("./"),
-    out_path_is_absolute_(false) {
+  t_program(std::string path) : path_(path), out_path_("./"), out_path_is_absolute_(false) {
     name_ = program_name(path);
     scope_ = new t_scope();
   }
 
-  ~t_program()
-  {
-   if(scope_)
-   {
-     delete scope_;
-     scope_ = NULL;
-   }
+  ~t_program() {
+    if (scope_) {
+      delete scope_;
+      scope_ = NULL;
+    }
   }
 
   // Path accessor
@@ -101,23 +93,27 @@ class t_program : public t_doc {
   const std::string& get_include_prefix() const { return include_prefix_; }
 
   // Accessors for program elements
-  const std::vector<t_typedef*>& get_typedefs()  const { return typedefs_;  }
-  const std::vector<t_enum*>&    get_enums()     const { return enums_;     }
-  const std::vector<t_const*>&   get_consts()    const { return consts_;    }
-  const std::vector<t_struct*>&  get_structs()   const { return structs_;   }
-  const std::vector<t_struct*>&  get_xceptions() const { return xceptions_; }
-  const std::vector<t_struct*>&  get_objects()   const { return objects_;   }
-  const std::vector<t_service*>& get_services()  const { return services_;  }
+  const std::vector<t_typedef*>& get_typedefs() const { return typedefs_; }
+  const std::vector<t_enum*>& get_enums() const { return enums_; }
+  const std::vector<t_const*>& get_consts() const { return consts_; }
+  const std::vector<t_struct*>& get_structs() const { return structs_; }
+  const std::vector<t_struct*>& get_xceptions() const { return xceptions_; }
+  const std::vector<t_struct*>& get_objects() const { return objects_; }
+  const std::vector<t_service*>& get_services() const { return services_; }
 
   // Program elements
-  void add_typedef  (t_typedef* td) { typedefs_.push_back(td);  }
-  void add_enum     (t_enum*    te) { enums_.push_back(te);     }
-  void add_const    (t_const*   tc) { consts_.push_back(tc);    }
-  void add_struct   (t_struct*  ts) { objects_.push_back(ts);
-                                      structs_.push_back(ts);   }
-  void add_xception (t_struct*  tx) { objects_.push_back(tx);
-                                      xceptions_.push_back(tx); }
-  void add_service  (t_service* ts) { services_.push_back(ts);  }
+  void add_typedef(t_typedef* td) { typedefs_.push_back(td); }
+  void add_enum(t_enum* te) { enums_.push_back(te); }
+  void add_const(t_const* tc) { consts_.push_back(tc); }
+  void add_struct(t_struct* ts) {
+    objects_.push_back(ts);
+    structs_.push_back(ts);
+  }
+  void add_xception(t_struct* tx) {
+    objects_.push_back(tx);
+    xceptions_.push_back(tx);
+  }
+  void add_service(t_service* ts) { services_.push_back(ts); }
 
   // Programs to include
   const std::vector<t_program*>& get_includes() const { return includes_; }
@@ -138,10 +134,9 @@ class t_program : public t_doc {
    * @param t    the type to test for collisions
    * @return     true if a certain collision was found, otherwise false
    */
-  bool is_unique_typename(t_type * t) {
+  bool is_unique_typename(t_type* t) {
     int occurances = program_typename_count(this, t);
-    for (std::vector<t_program*>::iterator it = includes_.begin();
-         it != includes_.end(); ++it) {
+    for (std::vector<t_program*>::iterator it = includes_.begin(); it != includes_.end(); ++it) {
       occurances += program_typename_count(*it, t);
     }
     return 0 == occurances;
@@ -153,7 +148,7 @@ class t_program : public t_doc {
    * @param t    the type to test for collisions
    * @return     the number of certain typename collisions
    */
-  int program_typename_count(t_program * prog, t_type * t) {
+  int program_typename_count(t_program* prog, t_type* t) {
     int occurances = 0;
     occurances += collection_typename_count(prog, prog->typedefs_, t);
     occurances += collection_typename_count(prog, prog->enums_, t);
@@ -170,7 +165,7 @@ class t_program : public t_doc {
    * @return                the number of certain typename collisions
    */
   template <class T>
-  int collection_typename_count(t_program * prog, T type_collection, t_type * t) {
+  int collection_typename_count(t_program* prog, T type_collection, t_type* t) {
     int occurances = 0;
     for (typename T::iterator it = type_collection.begin(); it != type_collection.end(); ++it)
       if (t != *it && 0 == t->get_name().compare((*it)->get_name()) && is_common_namespace(prog, t))
@@ -190,54 +185,67 @@ class t_program : public t_doc {
    * @param t    the type containing the typename match
    * @return     true if a collision within namespaces is found, otherwise false
    */
-  bool is_common_namespace(t_program * prog, t_type * t) {
-    //Case 1: Typenames are in the same program [collision]
+  bool is_common_namespace(t_program* prog, t_type* t) {
+    // Case 1: Typenames are in the same program [collision]
     if (prog == t->get_program()) {
-      pwarning(1, "Duplicate typename %s found in %s",
-               t->get_name().c_str(), t->get_program()->get_name().c_str());
+      pwarning(1,
+               "Duplicate typename %s found in %s",
+               t->get_name().c_str(),
+               t->get_program()->get_name().c_str());
       return true;
     }
 
-    //Case 2: Both programs have identical namespace scope/name declarations [collision]
+    // Case 2: Both programs have identical namespace scope/name declarations [collision]
     bool match = true;
     for (std::map<std::string, std::string>::iterator it = prog->namespaces_.begin();
-         it != prog->namespaces_.end(); ++it) {
+         it != prog->namespaces_.end();
+         ++it) {
       if (0 == it->second.compare(t->get_program()->get_namespace(it->first))) {
-        pwarning(1, "Duplicate typename %s found in %s,%s,%s and %s,%s,%s [file,scope,ns]",
+        pwarning(1,
+                 "Duplicate typename %s found in %s,%s,%s and %s,%s,%s [file,scope,ns]",
                  t->get_name().c_str(),
-                 t->get_program()->get_name().c_str(), it->first.c_str(), it->second.c_str(),
-                 prog->get_name().c_str(), it->first.c_str(), it->second.c_str());
+                 t->get_program()->get_name().c_str(),
+                 it->first.c_str(),
+                 it->second.c_str(),
+                 prog->get_name().c_str(),
+                 it->first.c_str(),
+                 it->second.c_str());
       } else {
         match = false;
       }
     }
     for (std::map<std::string, std::string>::iterator it = t->get_program()->namespaces_.begin();
-         it != t->get_program()->namespaces_.end(); ++it) {
+         it != t->get_program()->namespaces_.end();
+         ++it) {
       if (0 == it->second.compare(prog->get_namespace(it->first))) {
-        pwarning(1, "Duplicate typename %s found in %s,%s,%s and %s,%s,%s [file,scope,ns]",
+        pwarning(1,
+                 "Duplicate typename %s found in %s,%s,%s and %s,%s,%s [file,scope,ns]",
                  t->get_name().c_str(),
-                 t->get_program()->get_name().c_str(), it->first.c_str(), it->second.c_str(),
-                 prog->get_name().c_str(), it->first.c_str(), it->second.c_str());
+                 t->get_program()->get_name().c_str(),
+                 it->first.c_str(),
+                 it->second.c_str(),
+                 prog->get_name().c_str(),
+                 it->first.c_str(),
+                 it->second.c_str());
       } else {
         match = false;
       }
     }
     if (0 == prog->namespaces_.size() && 0 == t->get_program()->namespaces_.size()) {
-      pwarning(1, "Duplicate typename %s found in %s and %s",
-        t->get_name().c_str(), t->get_program()->get_name().c_str(),  prog->get_name().c_str());
+      pwarning(1,
+               "Duplicate typename %s found in %s and %s",
+               t->get_name().c_str(),
+               t->get_program()->get_name().c_str(),
+               prog->get_name().c_str());
     }
     return match;
   }
 
   // Scoping and namespacing
-  void set_namespace(std::string name) {
-    namespace_ = name;
-  }
+  void set_namespace(std::string name) { namespace_ = name; }
 
   // Scope accessor
-  t_scope* scope() const {
-    return scope_;
-  }
+  t_scope* scope() const { return scope_; }
 
   // Includes
 
@@ -256,9 +264,7 @@ class t_program : public t_doc {
     includes_.push_back(program);
   }
 
-  std::vector<t_program*>& get_includes() {
-    return includes_;
-  }
+  std::vector<t_program*>& get_includes() { return includes_; }
 
   void set_include_prefix(std::string include_prefix) {
     include_prefix_ = include_prefix;
@@ -277,7 +283,7 @@ class t_program : public t_doc {
       std::string base_language = language.substr(0, sub_index);
       std::string sub_namespace;
 
-      if(base_language == "smalltalk") {
+      if (base_language == "smalltalk") {
         pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
         base_language = "st";
       }
@@ -285,16 +291,17 @@ class t_program : public t_doc {
       t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map();
 
       t_generator_registry::gen_map_t::iterator it;
-      it=my_copy.find(base_language);
+      it = my_copy.find(base_language);
 
       if (it == my_copy.end()) {
         std::string warning = "No generator named '" + base_language + "' could be found!";
         pwarning(1, warning.c_str());
       } else {
         if (sub_index != std::string::npos) {
-          std::string sub_namespace = language.substr(sub_index+1);
-          if ( ! it->second->is_valid_namespace(sub_namespace)) {
-            std::string warning = base_language + " generator does not accept '" + sub_namespace + "' as sub-namespace!";
+          std::string sub_namespace = language.substr(sub_index + 1);
+          if (!it->second->is_valid_namespace(sub_namespace)) {
+            std::string warning = base_language + " generator does not accept '" + sub_namespace
+                                  + "' as sub-namespace!";
             pwarning(1, warning.c_str());
           }
         }
@@ -306,8 +313,8 @@ class t_program : public t_doc {
 
   std::string get_namespace(std::string language) const {
     std::map<std::string, std::string>::const_iterator iter;
-    if ((iter = namespaces_.find(language)) != namespaces_.end() ||
-        (iter = namespaces_.find("*"     )) != namespaces_.end()) {
+    if ((iter = namespaces_.find(language)) != namespaces_.end()
+        || (iter = namespaces_.find("*")) != namespaces_.end()) {
       return iter->second;
     }
     return std::string();
@@ -315,24 +322,15 @@ class t_program : public t_doc {
 
   // Language specific namespace / packaging
 
-  void add_cpp_include(std::string path) {
-    cpp_includes_.push_back(path);
-  }
-
-  const std::vector<std::string>& get_cpp_includes() {
-    return cpp_includes_;
-  }
+  void add_cpp_include(std::string path) { cpp_includes_.push_back(path); }
 
-  void add_c_include(std::string path) {
-    c_includes_.push_back(path);
-  }
+  const std::vector<std::string>& get_cpp_includes() { return cpp_includes_; }
 
-  const std::vector<std::string>& get_c_includes() {
-    return c_includes_;
-  }
+  void add_c_include(std::string path) { c_includes_.push_back(path); }
 
- private:
+  const std::vector<std::string>& get_c_includes() { return c_includes_; }
 
+private:
   // File path
   std::string path_;
 
@@ -359,11 +357,11 @@ class t_program : public t_doc {
 
   // Components to generate code for
   std::vector<t_typedef*> typedefs_;
-  std::vector<t_enum*>    enums_;
-  std::vector<t_const*>   consts_;
-  std::vector<t_struct*>  objects_;
-  std::vector<t_struct*>  structs_;
-  std::vector<t_struct*>  xceptions_;
+  std::vector<t_enum*> enums_;
+  std::vector<t_const*> consts_;
+  std::vector<t_struct*> objects_;
+  std::vector<t_struct*> structs_;
+  std::vector<t_struct*> xceptions_;
   std::vector<t_service*> services_;
 
   // Dynamic namespaces
@@ -374,7 +372,6 @@ class t_program : public t_doc {
 
   // C extra includes
   std::vector<std::string> c_includes_;
-
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_scope.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_scope.h b/compiler/cpp/src/parse/t_scope.h
index e73c0f3..c108fdd 100644
--- a/compiler/cpp/src/parse/t_scope.h
+++ b/compiler/cpp/src/parse/t_scope.h
@@ -40,24 +40,16 @@
  *
  */
 class t_scope {
- public:
+public:
   t_scope() {}
 
-  void add_type(std::string name, t_type* type) {
-    types_[name] = type;
-  }
+  void add_type(std::string name, t_type* type) { types_[name] = type; }
 
-  t_type* get_type(std::string name) {
-    return types_[name];
-  }
+  t_type* get_type(std::string name) { return types_[name]; }
 
-  void add_service(std::string name, t_service* service) {
-    services_[name] = service;
-  }
+  void add_service(std::string name, t_service* service) { services_[name] = service; }
 
-  t_service* get_service(std::string name) {
-    return services_[name];
-  }
+  t_service* get_service(std::string name) { return services_[name]; }
 
   void add_constant(std::string name, t_const* constant) {
     if (constants_.find(name) != constants_.end()) {
@@ -67,16 +59,12 @@ class t_scope {
     }
   }
 
-  t_const* get_constant(std::string name) {
-    return constants_[name];
-  }
+  t_const* get_constant(std::string name) { return constants_[name]; }
 
   void print() {
     std::map<std::string, t_type*>::iterator iter;
     for (iter = types_.begin(); iter != types_.end(); ++iter) {
-      printf("%s => %s\n",
-             iter->first.c_str(),
-             iter->second->get_name().c_str());
+      printf("%s => %s\n", iter->first.c_str(), iter->second->get_name().c_str());
     }
   }
 
@@ -101,7 +89,8 @@ class t_scope {
       for (v_iter = map.begin(); v_iter != map.end(); ++v_iter) {
         t_field* field = tstruct->get_field_by_name(v_iter->first->get_string());
         if (field == NULL) {
-          throw "No field named \"" + v_iter->first->get_string() + "\" was found in struct of type \"" + tstruct->get_name() + "\"";
+          throw "No field named \"" + v_iter->first->get_string()
+              + "\" was found in struct of type \"" + tstruct->get_name() + "\"";
         }
         resolve_const_value(v_iter->second, field->get_type());
       }
@@ -119,21 +108,21 @@ class t_scope {
 
         if (const_type->is_base_type()) {
           switch (((t_base_type*)const_type)->get_base()) {
-            case t_base_type::TYPE_I16:
-            case t_base_type::TYPE_I32:
-            case t_base_type::TYPE_I64:
-            case t_base_type::TYPE_BOOL:
-            case t_base_type::TYPE_BYTE:
-              const_val->set_integer(constant->get_value()->get_integer());
-              break;
-            case t_base_type::TYPE_STRING:
-              const_val->set_string(constant->get_value()->get_string());
-              break;
-            case t_base_type::TYPE_DOUBLE:
-              const_val->set_double(constant->get_value()->get_double());
-              break;
-            case t_base_type::TYPE_VOID:
-              throw "Constants cannot be of type VOID";
+          case t_base_type::TYPE_I16:
+          case t_base_type::TYPE_I32:
+          case t_base_type::TYPE_I64:
+          case t_base_type::TYPE_BOOL:
+          case t_base_type::TYPE_BYTE:
+            const_val->set_integer(constant->get_value()->get_integer());
+            break;
+          case t_base_type::TYPE_STRING:
+            const_val->set_string(constant->get_value()->get_string());
+            break;
+          case t_base_type::TYPE_DOUBLE:
+            const_val->set_double(constant->get_value()->get_double());
+            break;
+          case t_base_type::TYPE_VOID:
+            throw "Constants cannot be of type VOID";
           }
         } else if (const_type->is_map()) {
           const std::map<t_const_value*, t_const_value*>& map = constant->get_value()->get_map();
@@ -161,15 +150,15 @@ class t_scope {
       if (enum_value == NULL) {
         std::ostringstream valstm;
         valstm << const_val->get_integer();
-        throw "Couldn't find a named value in enum " + tenum->get_name() + " for value " + valstm.str();
+        throw "Couldn't find a named value in enum " + tenum->get_name() + " for value "
+            + valstm.str();
       }
       const_val->set_identifier(tenum->get_name() + "." + enum_value->get_name());
       const_val->set_enum(tenum);
     }
   }
 
- private:
-
+private:
   // Map of names to types
   std::map<std::string, t_type*> types_;
 
@@ -178,7 +167,6 @@ class t_scope {
 
   // Map of names to services
   std::map<std::string, t_service*> services_;
-
 };
 
 #endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_service.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_service.h b/compiler/cpp/src/parse/t_service.h
index 31e6924..091403d 100644
--- a/compiler/cpp/src/parse/t_service.h
+++ b/compiler/cpp/src/parse/t_service.h
@@ -30,18 +30,12 @@ class t_program;
  *
  */
 class t_service : public t_type {
- public:
-  t_service(t_program* program) :
-    t_type(program),
-    extends_(NULL) {}
+public:
+  t_service(t_program* program) : t_type(program), extends_(NULL) {}
 
-  bool is_service() const {
-    return true;
-  }
+  bool is_service() const { return true; }
 
-  void set_extends(t_service* extends) {
-    extends_ = extends;
-  }
+  void set_extends(t_service* extends) { extends_ = extends; }
 
   void add_function(t_function* func) {
     std::vector<t_function*>::const_iterator iter;
@@ -53,20 +47,16 @@ class t_service : public t_type {
     functions_.push_back(func);
   }
 
-  const std::vector<t_function*>& get_functions() const {
-    return functions_;
-  }
+  const std::vector<t_function*>& get_functions() const { return functions_; }
 
-  t_service* get_extends() {
-    return extends_;
-  }
+  t_service* get_extends() { return extends_; }
 
   virtual std::string get_fingerprint_material() const {
     // Services should never be used in fingerprints.
     throw "BUG: Can't get fingerprint material for service.";
   }
 
- private:
+private:
   std::vector<t_function*> functions_;
   t_service* extends_;
 };

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_set.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_set.h b/compiler/cpp/src/parse/t_set.h
index d198357..ccfc701 100644
--- a/compiler/cpp/src/parse/t_set.h
+++ b/compiler/cpp/src/parse/t_set.h
@@ -27,17 +27,12 @@
  *
  */
 class t_set : public t_container {
- public:
-  t_set(t_type* elem_type) :
-    elem_type_(elem_type) {}
+public:
+  t_set(t_type* elem_type) : elem_type_(elem_type) {}
 
-  t_type* get_elem_type() const {
-    return elem_type_;
-  }
+  t_type* get_elem_type() const { return elem_type_; }
 
-  bool is_set() const {
-    return true;
-  }
+  bool is_set() const { return true; }
 
   virtual std::string get_fingerprint_material() const {
     return "set<" + elem_type_->get_fingerprint_material() + ">";
@@ -48,7 +43,7 @@ class t_set : public t_container {
     elem_type_->generate_fingerprint();
   }
 
- private:
+private:
   t_type* elem_type_;
 };
 

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_struct.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_struct.h b/compiler/cpp/src/parse/t_struct.h
index 8dd4c73..2282676 100644
--- a/compiler/cpp/src/parse/t_struct.h
+++ b/compiler/cpp/src/parse/t_struct.h
@@ -37,58 +37,59 @@ class t_program;
  *
  */
 class t_struct : public t_type {
- public:
+public:
   typedef std::vector<t_field*> members_type;
 
-  t_struct(t_program* program) :
-    t_type(program),
-    is_xception_(false),
-    is_union_(false),
-    members_validated(false),
-    members_with_value(0),
-    xsd_all_(false) {}
-
-  t_struct(t_program* program, const std::string& name) :
-    t_type(program, name),
-    is_xception_(false),
-    is_union_(false),
-    members_validated(false),
-    members_with_value(0),
-    xsd_all_(false) {}
+  t_struct(t_program* program)
+    : t_type(program),
+      is_xception_(false),
+      is_union_(false),
+      members_validated(false),
+      members_with_value(0),
+      xsd_all_(false) {}
+
+  t_struct(t_program* program, const std::string& name)
+    : t_type(program, name),
+      is_xception_(false),
+      is_union_(false),
+      members_validated(false),
+      members_with_value(0),
+      xsd_all_(false) {}
 
   void set_name(const std::string& name) {
     name_ = name;
     validate_union_members();
   }
 
-  void set_xception(bool is_xception) {
-    is_xception_ = is_xception;
-  }
+  void set_xception(bool is_xception) { is_xception_ = is_xception; }
 
-  void validate_union_member( t_field * field) {
-    if( is_union_ && (! name_.empty())) {
+  void validate_union_member(t_field* field) {
+    if (is_union_ && (!name_.empty())) {
 
       // unions can't have required fields
-      if( field->get_req() == t_field::T_REQUIRED) {
-        pwarning(  1, "Required field %s of union %s set to optional.\n", field->get_name().c_str(), name_.c_str());
-        field->set_req( t_field::T_OPTIONAL);
+      if (field->get_req() == t_field::T_REQUIRED) {
+        pwarning(1,
+                 "Required field %s of union %s set to optional.\n",
+                 field->get_name().c_str(),
+                 name_.c_str());
+        field->set_req(t_field::T_OPTIONAL);
       }
 
       // unions may have up to one member defaulted, but not more
-      if( field->get_value() != NULL) {
-        if( 1 < ++members_with_value) {
-          throw "Error: Field "+field->get_name()+" provides another default value for union "+name_;
+      if (field->get_value() != NULL) {
+        if (1 < ++members_with_value) {
+          throw "Error: Field " + field->get_name() + " provides another default value for union "
+              + name_;
         }
       }
     }
-
   }
 
   void validate_union_members() {
-    if( is_union_ && (! name_.empty()) && (!members_validated)) {
+    if (is_union_ && (!name_.empty()) && (!members_validated)) {
       members_type::const_iterator m_iter;
       for (m_iter = members_in_id_order_.begin(); m_iter != members_in_id_order_.end(); ++m_iter) {
-        validate_union_member( *m_iter);
+        validate_union_member(*m_iter);
       }
       members_validated = true;
     }
@@ -99,19 +100,16 @@ class t_struct : public t_type {
     validate_union_members();
   }
 
-  void set_xsd_all(bool xsd_all) {
-    xsd_all_ = xsd_all;
-  }
+  void set_xsd_all(bool xsd_all) { xsd_all_ = xsd_all; }
 
-  bool get_xsd_all() const {
-    return xsd_all_;
-  }
+  bool get_xsd_all() const { return xsd_all_; }
 
   bool append(t_field* elem) {
     typedef members_type::iterator iter_type;
-    std::pair<iter_type, iter_type> bounds = std::equal_range(
-            members_in_id_order_.begin(), members_in_id_order_.end(), elem, t_field::key_compare()
-        );
+    std::pair<iter_type, iter_type> bounds = std::equal_range(members_in_id_order_.begin(),
+                                                              members_in_id_order_.end(),
+                                                              elem,
+                                                              t_field::key_compare());
     if (bounds.first != bounds.second) {
       return false;
     }
@@ -121,29 +119,19 @@ class t_struct : public t_type {
     }
     members_.push_back(elem);
     members_in_id_order_.insert(bounds.second, elem);
-    validate_union_member( elem);
+    validate_union_member(elem);
     return true;
   }
 
-  const members_type& get_members() {
-    return members_;
-  }
+  const members_type& get_members() { return members_; }
 
-  const members_type& get_sorted_members() {
-    return members_in_id_order_;
-  }
+  const members_type& get_sorted_members() { return members_in_id_order_; }
 
-  bool is_struct() const {
-    return !is_xception_;
-  }
+  bool is_struct() const { return !is_xception_; }
 
-  bool is_xception() const {
-    return is_xception_;
-  }
+  bool is_xception() const { return is_xception_; }
 
-  bool is_union() const {
-    return is_union_;
-  }
+  bool is_union() const { return is_union_; }
 
   virtual std::string get_fingerprint_material() const {
     std::string rv = "{";
@@ -154,9 +142,9 @@ class t_struct : public t_type {
       rv += (*m_iter)->get_fingerprint_material();
       rv += ";";
 
-      if( do_reserve) {
+      if (do_reserve) {
         estimation = members_in_id_order_.size() * rv.size() + 16;
-        rv.reserve( estimation);
+        rv.reserve(estimation);
         do_reserve = false;
       }
     }
@@ -182,14 +170,13 @@ class t_struct : public t_type {
     return NULL;
   }
 
- private:
-
+private:
   members_type members_;
   members_type members_in_id_order_;
   bool is_xception_;
   bool is_union_;
   bool members_validated;
-  int  members_with_value;
+  int members_with_value;
 
   bool xsd_all_;
 };

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_type.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_type.h b/compiler/cpp/src/parse/t_type.h
index b85f2da..20409f3 100644
--- a/compiler/cpp/src/parse/t_type.h
+++ b/compiler/cpp/src/parse/t_type.h
@@ -37,38 +37,30 @@ class t_program;
  *
  */
 class t_type : public t_doc {
- public:
+public:
   virtual ~t_type() {}
 
-  virtual void set_name(const std::string& name) {
-    name_ = name;
-  }
+  virtual void set_name(const std::string& name) { name_ = name; }
 
-  virtual const std::string& get_name() const {
-    return name_;
-  }
+  virtual const std::string& get_name() const { return name_; }
 
-  virtual bool is_void()      const { return false; }
+  virtual bool is_void() const { return false; }
   virtual bool is_base_type() const { return false; }
-  virtual bool is_string()    const { return false; }
-  virtual bool is_bool()      const { return false; }
-  virtual bool is_typedef()   const { return false; }
-  virtual bool is_enum()      const { return false; }
-  virtual bool is_struct()    const { return false; }
-  virtual bool is_xception()  const { return false; }
+  virtual bool is_string() const { return false; }
+  virtual bool is_bool() const { return false; }
+  virtual bool is_typedef() const { return false; }
+  virtual bool is_enum() const { return false; }
+  virtual bool is_struct() const { return false; }
+  virtual bool is_xception() const { return false; }
   virtual bool is_container() const { return false; }
-  virtual bool is_list()      const { return false; }
-  virtual bool is_set()       const { return false; }
-  virtual bool is_map()       const { return false; }
-  virtual bool is_service()   const { return false; }
+  virtual bool is_list() const { return false; }
+  virtual bool is_set() const { return false; }
+  virtual bool is_map() const { return false; }
+  virtual bool is_service() const { return false; }
 
-  t_program* get_program() {
-    return program_;
-  }
+  t_program* get_program() { return program_; }
 
-  const t_program* get_program() const {
-    return program_;
-  }
+  const t_program* get_program() const { return program_; }
 
   t_type* get_true_type();
 
@@ -95,8 +87,9 @@ class t_type : public t_doc {
     return false;
   }
 
-  const uint8_t* get_binary_fingerprint()  {
-    if(! has_fingerprint())  // lazy fingerprint generation, right now only used with the c++ generator
+  const uint8_t* get_binary_fingerprint() {
+    if (!has_fingerprint()) // lazy fingerprint generation, right now only used with the c++
+                            // generator
       generate_fingerprint();
     return fingerprint_;
   }
@@ -128,30 +121,16 @@ class t_type : public t_doc {
 
   std::map<std::string, std::string> annotations_;
 
- protected:
-  t_type() :
-    program_(NULL)
-  {
-    memset(fingerprint_, 0, sizeof(fingerprint_));
-  }
+protected:
+  t_type() : program_(NULL) { memset(fingerprint_, 0, sizeof(fingerprint_)); }
 
-  t_type(t_program* program) :
-    program_(program)
-  {
-    memset(fingerprint_, 0, sizeof(fingerprint_));
-  }
+  t_type(t_program* program) : program_(program) { memset(fingerprint_, 0, sizeof(fingerprint_)); }
 
-  t_type(t_program* program, std::string name) :
-    program_(program),
-    name_(name)
-  {
+  t_type(t_program* program, std::string name) : program_(program), name_(name) {
     memset(fingerprint_, 0, sizeof(fingerprint_));
   }
 
-  t_type(std::string name) :
-    program_(NULL),
-    name_(name)
-  {
+  t_type(std::string name) : program_(NULL), name_(name) {
     memset(fingerprint_, 0, sizeof(fingerprint_));
   }
 
@@ -161,7 +140,6 @@ class t_type : public t_doc {
   uint8_t fingerprint_[fingerprint_len];
 };
 
-
 /**
  * Placeholder struct for returning the key and value of an annotation
  * during parsing.

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/parse/t_typedef.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/parse/t_typedef.h b/compiler/cpp/src/parse/t_typedef.h
index 57d8df5..1051909 100644
--- a/compiler/cpp/src/parse/t_typedef.h
+++ b/compiler/cpp/src/parse/t_typedef.h
@@ -31,41 +31,31 @@
  *
  */
 class t_typedef : public t_type {
- public:
-  t_typedef(t_program* program, t_type* type, const std::string& symbolic) :
-    t_type(program, symbolic),
-    type_(type),
-    symbolic_(symbolic),
-    forward_(false),
-    seen_(false) {}
+public:
+  t_typedef(t_program* program, t_type* type, const std::string& symbolic)
+    : t_type(program, symbolic), type_(type), symbolic_(symbolic), forward_(false), seen_(false) {}
 
   /**
    * This constructor is used to refer to a type that is lazily
    * resolved at a later time, like for forward declarations or
    * recursive types.
    */
-  t_typedef(t_program* program, const std::string& symbolic, bool forward) :
-    t_type(program, symbolic),
-    type_(NULL),
-    symbolic_(symbolic),
-    forward_(forward),
-    seen_(false) {}
+  t_typedef(t_program* program, const std::string& symbolic, bool forward)
+    : t_type(program, symbolic),
+      type_(NULL),
+      symbolic_(symbolic),
+      forward_(forward),
+      seen_(false) {}
 
   ~t_typedef() {}
 
   t_type* get_type() const;
 
-  const std::string& get_symbolic() const {
-    return symbolic_;
-  }
+  const std::string& get_symbolic() const { return symbolic_; }
 
-  bool is_forward_typedef() const {
-    return forward_;
-  }
+  bool is_forward_typedef() const { return forward_; }
 
-  bool is_typedef() const {
-    return true;
-  }
+  bool is_typedef() const { return true; }
 
   virtual std::string get_fingerprint_material() const {
     if (!seen_) {
@@ -84,7 +74,7 @@ class t_typedef : public t_type {
     }
   }
 
- private:
+private:
   t_type* type_;
   std::string symbolic_;
   bool forward_;

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/compiler/cpp/src/windows/config.h
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/windows/config.h b/compiler/cpp/src/windows/config.h
index 4495672..a600080 100644
--- a/compiler/cpp/src/windows/config.h
+++ b/compiler/cpp/src/windows/config.h
@@ -38,9 +38,8 @@
 #define PRIi64 "I64d"
 
 // squelch deprecation warnings
-#pragma warning(disable:4996)
+#pragma warning(disable : 4996)
 // squelch bool conversion performance warning
-#pragma warning(disable:4800)
-
+#pragma warning(disable : 4800)
 
 #endif // _THRIFT_WINDOWS_CONFIG_H_

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 04107be..fde0ad6 100755
--- a/configure.ac
+++ b/configure.ac
@@ -100,6 +100,9 @@ AC_PROG_RANLIB
 AC_LANG([C++])
 AX_CXX_COMPILE_STDCXX_11([noext])
 
+AM_EXTRA_RECURSIVE_TARGETS([style])
+AC_SUBST(CPPSTYLE_CMD, 'find . -type f \( -iname "*.h" -or -iname "*.cpp" -or -iname "*.cc" -or -iname "*.tcc" \) -printf "Reformatting: %h/%f\n" -exec clang-format -i {} \;')
+
 AC_ARG_ENABLE([libs],
   AS_HELP_STRING([--enable-libs], [build the Apache Thrift libraries [default=yes]]),
   [], enable_libs=yes

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/lib/cpp/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 5206db8..d0bfe62 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -243,3 +243,6 @@ EXTRA_DIST = \
              thrift-z.pc.in \
              thrift-qt.pc.in \
              $(WINDOWS_DIST)
+
+style-local:
+	$(CPPSTYLE_CMD)

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/lib/cpp/src/thrift/TApplicationException.cpp
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/TApplicationException.cpp b/lib/cpp/src/thrift/TApplicationException.cpp
index 1110ba2..2f14653 100644
--- a/lib/cpp/src/thrift/TApplicationException.cpp
+++ b/lib/cpp/src/thrift/TApplicationException.cpp
@@ -20,7 +20,8 @@
 #include <thrift/TApplicationException.h>
 #include <thrift/protocol/TProtocol.h>
 
-namespace apache { namespace thrift {
+namespace apache {
+namespace thrift {
 
 uint32_t TApplicationException::read(apache::thrift::protocol::TProtocol* iprot) {
   uint32_t xfer = 0;
@@ -76,5 +77,5 @@ uint32_t TApplicationException::write(apache::thrift::protocol::TProtocol* oprot
   xfer += oprot->writeStructEnd();
   return xfer;
 }
-
-}} // apache::thrift
+}
+} // apache::thrift

http://git-wip-us.apache.org/repos/asf/thrift/blob/74260aa9/lib/cpp/src/thrift/TApplicationException.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/TApplicationException.h b/lib/cpp/src/thrift/TApplicationException.h
index d32a21d..0de5391 100644
--- a/lib/cpp/src/thrift/TApplicationException.h
+++ b/lib/cpp/src/thrift/TApplicationException.h
@@ -22,16 +22,15 @@
 
 #include <thrift/Thrift.h>
 
-
-namespace apache { namespace thrift {
+namespace apache {
+namespace thrift {
 
 namespace protocol {
-  class TProtocol;
+class TProtocol;
 }
 
 class TApplicationException : public TException {
- public:
-
+public:
   /**
    * Error codes for the various types of exceptions.
    */
@@ -49,22 +48,14 @@ class TApplicationException : public TException {
     UNSUPPORTED_CLIENT_TYPE = 10
   };
 
-  TApplicationException() :
-    TException(),
-    type_(UNKNOWN) {}
+  TApplicationException() : TException(), type_(UNKNOWN) {}
 
-  TApplicationException(TApplicationExceptionType type) :
-    TException(),
-    type_(type) {}
+  TApplicationException(TApplicationExceptionType type) : TException(), type_(type) {}
 
-  TApplicationException(const std::string& message) :
-    TException(message),
-    type_(UNKNOWN) {}
+  TApplicationException(const std::string& message) : TException(message), type_(UNKNOWN) {}
 
-  TApplicationException(TApplicationExceptionType type,
-                        const std::string& message) :
-    TException(message),
-    type_(type) {}
+  TApplicationException(TApplicationExceptionType type, const std::string& message)
+    : TException(message), type_(type) {}
 
   virtual ~TApplicationException() throw() {}
 
@@ -74,25 +65,35 @@ class TApplicationException : public TException {
    *
    * @return Error code
    */
-  TApplicationExceptionType getType() {
-    return type_;
-  }
+  TApplicationExceptionType getType() { return type_; }
 
   virtual const char* what() const throw() {
     if (message_.empty()) {
       switch (type_) {
-        case UNKNOWN                 : return "TApplicationException: Unknown application exception";
-        case UNKNOWN_METHOD          : return "TApplicationException: Unknown method";
-        case INVALID_MESSAGE_TYPE    : return "TApplicationException: Invalid message type";
-        case WRONG_METHOD_NAME       : return "TApplicationException: Wrong method name";
-        case BAD_SEQUENCE_ID         : return "TApplicationException: Bad sequence identifier";
-        case MISSING_RESULT          : return "TApplicationException: Missing result";
-        case INTERNAL_ERROR          : return "TApplicationException: Internal error";
-        case PROTOCOL_ERROR          : return "TApplicationException: Protocol error";
-        case INVALID_TRANSFORM       : return "TApplicationException: Invalid transform";
-        case INVALID_PROTOCOL        : return "TApplicationException: Invalid protocol";
-        case UNSUPPORTED_CLIENT_TYPE : return "TApplicationException: Unsupported client type";
-        default                      : return "TApplicationException: (Invalid exception type)";
+      case UNKNOWN:
+        return "TApplicationException: Unknown application exception";
+      case UNKNOWN_METHOD:
+        return "TApplicationException: Unknown method";
+      case INVALID_MESSAGE_TYPE:
+        return "TApplicationException: Invalid message type";
+      case WRONG_METHOD_NAME:
+        return "TApplicationException: Wrong method name";
+      case BAD_SEQUENCE_ID:
+        return "TApplicationException: Bad sequence identifier";
+      case MISSING_RESULT:
+        return "TApplicationException: Missing result";
+      case INTERNAL_ERROR:
+        return "TApplicationException: Internal error";
+      case PROTOCOL_ERROR:
+        return "TApplicationException: Protocol error";
+      case INVALID_TRANSFORM:
+        return "TApplicationException: Invalid transform";
+      case INVALID_PROTOCOL:
+        return "TApplicationException: Invalid protocol";
+      case UNSUPPORTED_CLIENT_TYPE:
+        return "TApplicationException: Unsupported client type";
+      default:
+        return "TApplicationException: (Invalid exception type)";
       };
     } else {
       return message_.c_str();
@@ -102,14 +103,13 @@ class TApplicationException : public TException {
   uint32_t read(protocol::TProtocol* iprot);
   uint32_t write(protocol::TProtocol* oprot) const;
 
- protected:
+protected:
   /**
    * Error code
    */
   TApplicationExceptionType type_;
-
 };
-
-}} // apache::thrift
+}
+} // apache::thrift
 
 #endif // #ifndef _THRIFT_TAPPLICATIONEXCEPTION_H_