Do more spring house cleaning: Remove PUFFIN_EXPORT

- Remove PUFFIN_EXPORT as puffin is not being build for shared libraries
  anymore.

- Move libbrillo dependency out of the base code into only the main, test and
  fuzzers.

- Add c++14 to Makefile

Bug: 74992491
Test: unittest
Change-Id: Iac1bb92091e307bf609d22f23cb1bdd3f0420eac
diff --git a/Android.bp b/Android.bp
index 54842b2..e66a2ac 100644
--- a/Android.bp
+++ b/Android.bp
@@ -2,7 +2,6 @@
     name: "puffin_defaults",
     host_supported: true,
     shared_libs: [
-        "libbrillo",
         "libchrome",
         "libprotobuf-cpp-lite",
     ],
@@ -73,6 +72,9 @@
         "src/extent_stream.cc",
         "src/main.cc",
     ],
+    shared_libs: [
+        "libbrillo",
+    ],
     static_libs: [
         "libbsdiff",
         "libbspatch",
@@ -99,6 +101,9 @@
         "src/unittest_common.cc",
         "src/utils_unittest.cc",
     ],
+    shared_libs: [
+        "libbrillo",
+    ],
     static_libs: [
         "libbsdiff",
         "libbspatch",
diff --git a/BUILD.gn b/BUILD.gn
index f6df14b..24d9c06 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -23,7 +23,6 @@
 pkg_config("target_defaults") {
   pkg_deps = [
     "libchrome-${libbase_ver}",
-    "libbrillo-${libbase_ver}",
     "protobuf-lite",
   ]
   cflags = [ "-Wextra" ]
@@ -94,8 +93,15 @@
   ]
 }
 
+pkg_config("libbrillo") {
+  pkg_deps = [
+    "libbrillo-${libbase_ver}",
+  ]
+}
+
 executable("puffin") {
   configs += [
+    ":libbrillo",
     ":target_defaults",
   ]
   deps = [
@@ -111,6 +117,7 @@
   executable("puffin_test") {
     configs += [
       "//common-mk:test",
+      ":libbrillo",
       ":target_defaults",
     ]
     sources = [
@@ -134,6 +141,7 @@
   executable("puffin_fuzzer") {
     configs += [
       "//common-mk/common_fuzzer",
+      ":libbrillo",
       ":target_defaults",
     ]
     deps = [
diff --git a/Makefile b/Makefile
index ae86afd..5caee34 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@
 UNITTESTS = puffin_unittests
 
 CXXFLAGS ?= -O3 -ggdb
-CXXFLAGS += -Wall -fPIC -std=c++11
+CXXFLAGS += -Wall -fPIC -std=c++14
 CPPFLAGS += -I../ -Isrc/include
 LDLIBS = -lgflags -lglog -lprotobuf-lite -lgtest -lpthread
 
diff --git a/src/include/puffin/common.h b/src/include/puffin/common.h
index 2ab1db8..954b7d9 100644
--- a/src/include/puffin/common.h
+++ b/src/include/puffin/common.h
@@ -9,25 +9,12 @@
 #include <memory>
 #include <vector>
 
-#ifdef USE_BRILLO
-#include "base/macros.h"
-#include "brillo/brillo_export.h"
-#define PUFFIN_EXPORT BRILLO_EXPORT
-
-#else  // USE_BRILLO
-
 #ifndef DISALLOW_COPY_AND_ASSIGN
 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
   TypeName(const TypeName&) = delete;      \
   void operator=(const TypeName&) = delete
 #endif  // DISALLOW_COPY_AND_ASSIGN
 
-#ifndef PUFFIN_EXPORT
-#define PUFFIN_EXPORT __attribute__((__visibility__("default")))
-#endif  // PUFFIN_EXPORT
-
-#endif  // USE_BRILLO
-
 #ifndef FALLTHROUGH_INTENDED
 #ifdef __clang__
 #define FALLTHROUGH_INTENDED [[clang::fallthrough]]
@@ -43,7 +30,7 @@
 // This class is similar to the protobuf generated for |ProtoByteExtent|. We
 // defined an extra class so the users of puffin do not have to include
 // puffin.pb.h and deal with its use.
-struct PUFFIN_EXPORT ByteExtent {
+struct ByteExtent {
   ByteExtent(uint64_t offset, uint64_t length)
       : offset(offset), length(length) {}
 
@@ -55,7 +42,7 @@
   uint64_t length;
 };
 
-struct PUFFIN_EXPORT BitExtent {
+struct BitExtent {
   BitExtent(uint64_t offset, uint64_t length)
       : offset(offset), length(length) {}
 
diff --git a/src/include/puffin/huffer.h b/src/include/puffin/huffer.h
index 4e6e42f..967b3e8 100644
--- a/src/include/puffin/huffer.h
+++ b/src/include/puffin/huffer.h
@@ -16,7 +16,7 @@
 class PuffReaderInterface;
 class HuffmanTable;
 
-class PUFFIN_EXPORT Huffer {
+class Huffer {
  public:
   Huffer();
   ~Huffer();
diff --git a/src/include/puffin/puffdiff.h b/src/include/puffin/puffdiff.h
index 434dac7..c8883bf 100644
--- a/src/include/puffin/puffdiff.h
+++ b/src/include/puffin/puffdiff.h
@@ -47,7 +47,6 @@
 
 // The default puffdiff function that uses both bz2 and brotli to compress the
 // patch data.
-PUFFIN_EXPORT
 bool PuffDiff(const Buffer& src,
               const Buffer& dst,
               const std::vector<BitExtent>& src_deflates,
diff --git a/src/include/puffin/puffer.h b/src/include/puffin/puffer.h
index f7b7c98..a472f87 100644
--- a/src/include/puffin/puffer.h
+++ b/src/include/puffin/puffer.h
@@ -17,7 +17,7 @@
 class PuffWriterInterface;
 class HuffmanTable;
 
-class PUFFIN_EXPORT Puffer {
+class Puffer {
  public:
   // In older versions of puffin, there is a bug in the client which incorrectly
   // identifies the number of bits to cache when number of bits for the current
diff --git a/src/include/puffin/puffpatch.h b/src/include/puffin/puffpatch.h
index 46540cb..4eaa14b 100644
--- a/src/include/puffin/puffpatch.h
+++ b/src/include/puffin/puffpatch.h
@@ -25,7 +25,6 @@
 // |patch|         IN  The input patch.
 // |patch_length|  IN  The length of the patch.
 // |max_cache_size|IN  The maximum amount of memory to cache puff buffers.
-PUFFIN_EXPORT
 bool PuffPatch(UniqueStreamPtr src,
                UniqueStreamPtr dst,
                const uint8_t* patch,
diff --git a/src/include/puffin/utils.h b/src/include/puffin/utils.h
index 737454d..e8a8f8e 100644
--- a/src/include/puffin/utils.h
+++ b/src/include/puffin/utils.h
@@ -16,7 +16,7 @@
 // Converts an array of |ByteExtens| or |BitExtents| to a string. Each extent
 // has format "offset:length" and are comma separated.
 template <typename T>
-PUFFIN_EXPORT std::string ExtentsToString(const T& extents) {
+std::string ExtentsToString(const T& extents) {
   std::string str;
   for (const auto& extent : extents) {
     str += std::to_string(extent.offset) + ":" + std::to_string(extent.length) +
@@ -45,7 +45,6 @@
 
 // Uses the function above, to locate deflates (bit addressed) in a given file
 // |file_path| using the list of zlib blocks |zlibs|.
-PUFFIN_EXPORT
 bool LocateDeflatesInZlibBlocks(const std::string& file_path,
                                 const std::vector<ByteExtent>& zlibs,
                                 std::vector<BitExtent>* deflates);
@@ -55,7 +54,6 @@
 bool LocateDeflatesInGzip(const Buffer& data, std::vector<BitExtent>* deflates);
 
 // Search for the deflates in a zip archive, and put the result in |deflates|.
-PUFFIN_EXPORT
 bool LocateDeflatesInZipArchive(const Buffer& data,
                                 std::vector<BitExtent>* deflates);
 
@@ -78,7 +76,6 @@
 // Removes any BitExtents from both |extents1| and |extents2| if the data it
 // points to is found in both |extents1| and |extents2|. The order of the
 // remaining BitExtents is preserved.
-PUFFIN_EXPORT
 void RemoveEqualBitExtents(const Buffer& data1,
                            const Buffer& data2,
                            std::vector<BitExtent>* extents1,