Switch the rest of our internal headers to #pragma once.
We've been using #pragma once for new internal files, but let's be more bold.
Bug: N/A
Test: builds
Change-Id: I7e2ee2730043bd884f9571cdbd8b524043030c07
diff --git a/linker/linked_list.h b/linker/linked_list.h
index ed2b150..048ea4d 100644
--- a/linker/linked_list.h
+++ b/linker/linked_list.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKED_LIST_H
-#define __LINKED_LIST_H
+#pragma once
#include "private/bionic_macros.h"
@@ -259,5 +258,3 @@
LinkedListEntry<T>* tail_;
DISALLOW_COPY_AND_ASSIGN(LinkedList);
};
-
-#endif // __LINKED_LIST_H
diff --git a/linker/linker.h b/linker/linker.h
index 29d40fa..260c89d 100644
--- a/linker/linker.h
+++ b/linker/linker.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _LINKER_H_
-#define _LINKER_H_
+#pragma once
#include <dlfcn.h>
#include <android/dlext.h>
@@ -187,5 +186,3 @@
void increment_dso_handle_reference_counter(void* dso_handle);
void decrement_dso_handle_reference_counter(void* dso_handle);
-
-#endif
diff --git a/linker/linker_allocator.h b/linker/linker_allocator.h
index 7fc6cbf..82e4ef4 100644
--- a/linker/linker_allocator.h
+++ b/linker/linker_allocator.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_ALLOCATOR_H
-#define __LINKER_ALLOCATOR_H
+#pragma once
#include <errno.h>
#include <stdlib.h>
@@ -152,6 +151,3 @@
LinkerSmallObjectAllocator* allocators_;
uint8_t allocators_buf_[sizeof(LinkerSmallObjectAllocator)*kSmallObjectAllocatorsCount];
};
-
-
-#endif /* __LINKER_ALLOCATOR_H */
diff --git a/linker/linker_block_allocator.h b/linker/linker_block_allocator.h
index eba1db2..b501659 100644
--- a/linker/linker_block_allocator.h
+++ b/linker/linker_block_allocator.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_BLOCK_ALLOCATOR_H
-#define __LINKER_BLOCK_ALLOCATOR_H
+#pragma once
#include <stdlib.h>
#include <limits.h>
@@ -89,5 +88,3 @@
LinkerBlockAllocator block_allocator_;
DISALLOW_COPY_AND_ASSIGN(LinkerTypeAllocator);
};
-
-#endif // __LINKER_BLOCK_ALLOCATOR_H
diff --git a/linker/linker_cfi.h b/linker/linker_cfi.h
index e54554f..f3300d6 100644
--- a/linker/linker_cfi.h
+++ b/linker/linker_cfi.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _LINKER_CFI_H_
-#define _LINKER_CFI_H_
+#pragma once
#include "linker.h"
#include "linker_debug.h"
@@ -103,5 +102,3 @@
};
CFIShadowWriter* get_cfi_shadow();
-
-#endif // _LINKER_CFI_H_
diff --git a/linker/linker_common_types.h b/linker/linker_common_types.h
index 6afd950..ffa4066 100644
--- a/linker/linker_common_types.h
+++ b/linker/linker_common_types.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_COMMON_TYPES_H
-#define __LINKER_COMMON_TYPES_H
+#pragma once
#include <android/dlext.h>
#include "linked_list.h"
@@ -65,5 +64,3 @@
typedef LinkedList<soinfo, SoinfoListAllocator> soinfo_list_t;
typedef LinkedList<android_namespace_t, NamespaceListAllocator> android_namespace_list_t;
-
-#endif /* __LINKER_COMMON_TYPES_H */
diff --git a/linker/linker_config.h b/linker/linker_config.h
index 0c50d57..e117aea 100644
--- a/linker/linker_config.h
+++ b/linker/linker_config.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _LINKER_CONFIG_H_
-#define _LINKER_CONFIG_H_
+#pragma once
#include <android/api-level.h>
@@ -171,5 +170,3 @@
DISALLOW_COPY_AND_ASSIGN(Config);
};
-
-#endif /* _LINKER_CONFIG_H_ */
diff --git a/linker/linker_debug.h b/linker/linker_debug.h
index 7ceab08..862ea12 100644
--- a/linker/linker_debug.h
+++ b/linker/linker_debug.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _LINKER_DEBUG_H_
-#define _LINKER_DEBUG_H_
+#pragma once
// You can increase the verbosity of debug traces by defining the LD_DEBUG
// environment variable to a numeric value from 0 to 2 (corresponding to
@@ -102,5 +101,3 @@
#define MARK(x) do {} while (0)
#endif
-
-#endif /* _LINKER_DEBUG_H_ */
diff --git a/linker/linker_dlwarning.h b/linker/linker_dlwarning.h
index 68827f7..af26824 100644
--- a/linker/linker_dlwarning.h
+++ b/linker/linker_dlwarning.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_DLWARNING_H
-#define __LINKER_DLWARNING_H
+#pragma once
void add_dlwarning(const char* sopath, const char* message, const char* value = nullptr);
@@ -36,5 +35,3 @@
// is used to avoid forcing user into saving the message
// to a global variable.
void get_dlwarning(void* user_data, void (*f)(void*, const char*));
-
-#endif /* __LINKER_DLWARNING_H */
diff --git a/linker/linker_gdb_support.h b/linker/linker_gdb_support.h
index 6709da1..4ae18ee 100644
--- a/linker/linker_gdb_support.h
+++ b/linker/linker_gdb_support.h
@@ -25,8 +25,8 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#ifndef __LINKER_GDB_SUPPORT_H
-#define __LINKER_GDB_SUPPORT_H
+
+#pragma once
#include <link.h>
#include <sys/cdefs.h>
@@ -42,5 +42,3 @@
extern struct r_debug _r_debug;
__END_DECLS
-
-#endif
diff --git a/linker/linker_globals.h b/linker/linker_globals.h
index 11ccbd5..b470918 100644
--- a/linker/linker_globals.h
+++ b/linker/linker_globals.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_GLOBALS_H
-#define __LINKER_GLOBALS_H
+#pragma once
#include <link.h>
#include <stddef.h>
@@ -86,5 +85,3 @@
private:
std::string saved_error_msg_;
};
-
-#endif /* __LINKER_GLOBALS_H */
diff --git a/linker/linker_logger.h b/linker/linker_logger.h
index 3e53f74..9ce438e 100644
--- a/linker/linker_logger.h
+++ b/linker/linker_logger.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _LINKER_LOGGER_H_
-#define _LINKER_LOGGER_H_
+#pragma once
#include <stdlib.h>
#include <limits.h>
@@ -61,5 +60,3 @@
// If the system property debug.ld.greylist_disabled is true, we'll not use the greylist
// regardless of API level.
extern bool g_greylist_disabled;
-
-#endif /* _LINKER_LOGGER_H_ */
diff --git a/linker/linker_main.h b/linker/linker_main.h
index 5641696..8d486e8 100644
--- a/linker/linker_main.h
+++ b/linker/linker_main.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_MAIN_H
-#define __LINKER_MAIN_H
+#pragma once
#include <android/dlext.h>
@@ -71,5 +70,3 @@
bool solist_remove_soinfo(soinfo* si);
soinfo* solist_get_head();
soinfo* solist_get_somain();
-
-#endif
diff --git a/linker/linker_mapped_file_fragment.h b/linker/linker_mapped_file_fragment.h
index 0bfc7a3..f7872bd 100644
--- a/linker/linker_mapped_file_fragment.h
+++ b/linker/linker_mapped_file_fragment.h
@@ -25,8 +25,8 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#ifndef LINKER_MAPPED_FILE_FRAGMENT_H
-#define LINKER_MAPPED_FILE_FRAGMENT_H
+
+#pragma once
#include <unistd.h>
@@ -49,5 +49,3 @@
DISALLOW_COPY_AND_ASSIGN(MappedFileFragment);
};
-
-#endif /* LINKER_MAPPED_FILE_FRAGMENT_H */
diff --git a/linker/linker_namespaces.h b/linker/linker_namespaces.h
index a7fe0d5..03520d7 100644
--- a/linker/linker_namespaces.h
+++ b/linker/linker_namespaces.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_NAMESPACES_H
-#define __LINKER_NAMESPACES_H
+#pragma once
#include "linker_common_types.h"
@@ -164,5 +163,3 @@
DISALLOW_COPY_AND_ASSIGN(android_namespace_t);
};
-
-#endif /* __LINKER_NAMESPACES_H */
diff --git a/linker/linker_phdr.h b/linker/linker_phdr.h
index d6276ed..9b9ce94 100644
--- a/linker/linker_phdr.h
+++ b/linker/linker_phdr.h
@@ -25,8 +25,8 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#ifndef LINKER_PHDR_H
-#define LINKER_PHDR_H
+
+#pragma once
/* Declarations related to the ELF program header table and segments.
*
@@ -134,5 +134,3 @@
const char* phdr_table_get_interpreter_name(const ElfW(Phdr) * phdr_table, size_t phdr_count,
ElfW(Addr) load_bias);
-
-#endif /* LINKER_PHDR_H */
diff --git a/linker/linker_reloc_iterators.h b/linker/linker_reloc_iterators.h
index 6340924..b162684 100644
--- a/linker/linker_reloc_iterators.h
+++ b/linker/linker_reloc_iterators.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_RELOC_ITERATORS_H
-#define __LINKER_RELOC_ITERATORS_H
+#pragma once
#include "linker.h"
@@ -173,5 +172,3 @@
size_t relocation_group_index_;
rel_t reloc_;
};
-
-#endif // __LINKER_RELOC_ITERATORS_H
diff --git a/linker/linker_relocs.h b/linker/linker_relocs.h
index ed00594..4bab0e0 100644
--- a/linker/linker_relocs.h
+++ b/linker/linker_relocs.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_RELOCS_H
-#define __LINKER_RELOCS_H
+#pragma once
#include <elf.h>
@@ -62,5 +61,3 @@
#define R_GENERIC_IRELATIVE R_X86_64_IRELATIVE
#endif
-
-#endif // __LINKER_RELOCS_H
diff --git a/linker/linker_sleb128.h b/linker/linker_sleb128.h
index 01e127d..6bb3199 100644
--- a/linker/linker_sleb128.h
+++ b/linker/linker_sleb128.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef _LINKER_SLEB128_H
-#define _LINKER_SLEB128_H
+#pragma once
#include <stdint.h>
@@ -70,5 +69,3 @@
const uint8_t* current_;
const uint8_t* const end_;
};
-
-#endif // __LINKER_SLEB128_H
diff --git a/linker/linker_soinfo.h b/linker/linker_soinfo.h
index 447c7c3..6e1f005 100644
--- a/linker/linker_soinfo.h
+++ b/linker/linker_soinfo.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_SOINFO_H
-#define __LINKER_SOINFO_H
+#pragma once
#include <link.h>
@@ -386,5 +385,3 @@
}
}
}
-
-#endif /* __LINKER_SOINFO_H */
diff --git a/linker/linker_utils.h b/linker/linker_utils.h
index e104a25..214646c 100644
--- a/linker/linker_utils.h
+++ b/linker/linker_utils.h
@@ -26,8 +26,7 @@
* SUCH DAMAGE.
*/
-#ifndef __LINKER_UTILS_H
-#define __LINKER_UTILS_H
+#pragma once
#include <string>
#include <vector>
@@ -56,5 +55,3 @@
off64_t page_start(off64_t offset);
size_t page_offset(off64_t offset);
bool safe_add(off64_t* out, off64_t a, size_t b);
-
-#endif