1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Macros for stripping unnecessary string literals from binaries 6 // (especially for shipping outside of Google). 7 8 #ifndef BASE_GLOBAL_STRIP_OPTIONS_H_ 9 #define BASE_GLOBAL_STRIP_OPTIONS_H_ 10 11 // The global value of STRIP_LOG. All the messages logged to LOG(XXX) 12 // with severity less than STRIP_LOG will not be displayed. If it can 13 // be determined at compile time that the message will not be printed, 14 // the statement will be compiled out. STRIP_LOG can be set to a value 15 // between 0 and 4 where 0 logs all messages and 4 logs no messages. 16 // 17 // Example: to strip out all INFO and WARNING messages, use the value 18 // of 2 below. To make an exception for WARNING messages from a single 19 // file, add "#define STRIP_LOG 1" to that file _before_ including 20 // base/logging.h 21 // 22 // Example: In addition it's possible to remove the dependency on the base 23 // library if an executable or library currently only depends upon logging. 24 // 25 // # A library that only includes "base/basictypes.h" and "base/logging.h". 26 // cc_library(name = "mylibrary", 27 // srcs = [ "mymodule_that_logs.cc" ], 28 // deps = [ "//base" ]) 29 // 30 // The build rule for mylibrary can be modified as shown in the following... 31 // 32 // # A library with logging disabled. 33 // cc_library(name = "mylibrary_no_logging", 34 // srcs = [ "mymodule_that_logs.cc", 35 // "/base:logging.h" ], 36 // deps = [ "//third_party/stl" ], 37 // copts = [ "-DSTRIP_LOG=4" ] ) 38 // 39 // Finally if it's desirable to strip all logging from an executable build 40 // using... 41 // 42 // blaze build --copts="-DSTRIP_LOG=4" //mypackage:mylabel 43 44 45 #ifndef STRIP_LOG 46 #define STRIP_LOG 0 47 #endif 48 49 // By setting STRIP_FLAG_HELP to 1, we will replace the usage messages 50 // for command-line flags with "" (thus taking those string literals 51 // out of the binary). To make an exception for flags DEFINE'd in a 52 // certain file, add "#define STRIP_FLAG_HELP 0" to that file _before_ 53 // including base/commandlineflags.h 54 55 #ifndef STRIP_FLAG_HELP 56 #define STRIP_FLAG_HELP 0 57 #endif 58 59 #endif // BASE_GLOBAL_STRIP_OPTIONS_H_ 60