Copyright 2014->2015
[folly.git] / folly / build / GenerateFingerprintTables.cpp
index b864406db9294aa574ba18182427c16c051dbef8..60973e0745b923aaacbda2a4b9fddd46ff65c282 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 Facebook, Inc.
+ * Copyright 2015 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS 1
+#endif
+
 #include <cstdio>
+#include <cinttypes>
 
 #include <string>
 
 #include <glog/logging.h>
 #include <gflags/gflags.h>
 
-#include "folly/Format.h"
+#include <folly/Format.h>
 
-#include "folly/detail/FingerprintPolynomial.h"
+#include <folly/detail/FingerprintPolynomial.h>
 
 using namespace folly;
 using namespace folly::detail;
@@ -84,7 +89,7 @@ void computeTables(FILE* file, const FingerprintPolynomial<DEG>& poly) {
       "const uint64_t FingerprintTable<%d>::poly[%d] = {",
       DEG+1, FingerprintPolynomial<DEG>::size()));
   for (int j = 0; j < FingerprintPolynomial<DEG>::size(); j++) {
-    CHECK_ERR(fprintf(file, "%s%luLU", j ? ", " : "", poly_val[j]));
+    CHECK_ERR(fprintf(file, "%s%" PRIu64 "LU", j ? ", " : "", poly_val[j]));
   }
   CHECK_ERR(fprintf(file, "};\n\n"));
 
@@ -101,7 +106,8 @@ void computeTables(FILE* file, const FingerprintPolynomial<DEG>& poly) {
     for (int x = 0; x < 256; x++) {
       CHECK_ERR(fprintf(file, "    {"));
       for (int j = 0; j < FingerprintPolynomial<DEG>::size(); j++) {
-        CHECK_ERR(fprintf(file, "%s%luLU", (j ? ", " : ""), table[i][x][j]));
+        CHECK_ERR(fprintf(
+          file, "%s%" PRIu64 "LU", (j ? ", " : ""), table[i][x][j]));
       }
       CHECK_ERR(fprintf(file, "},\n"));
     }
@@ -113,7 +119,7 @@ void computeTables(FILE* file, const FingerprintPolynomial<DEG>& poly) {
 }  // namespace
 
 int main(int argc, char *argv[]) {
-  google::ParseCommandLineFlags(&argc, &argv, true);
+  gflags::ParseCommandLineFlags(&argc, &argv, true);
   google::InitGoogleLogging(argv[0]);
 
   std::string name = folly::format("{}/{}", FLAGS_install_dir,
@@ -128,7 +134,7 @@ int main(int argc, char *argv[]) {
       " * AUTOMATICALLY GENERATED.  DO NOT EDIT.\n"
       " */\n"
       "\n"
-      "#include \"folly/Fingerprint.h\"\n"
+      "#include <folly/Fingerprint.h>\n"
       "\n"
       "namespace folly {\n"
       "namespace detail {\n"