From 87274d0f22e1dfd99b2e5200e2fe75c1b804eac3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 12 Jul 2017 13:40:41 +0200 Subject: Reformat and sort all includes with clang-format This makes it easier to see which headers includes what. The changes were done by running git grep -l '#\s*include' \ | grep -E '.(cc|h)$' \ | xargs sed -i -E 's/(^\s*)#(\s*)include/\1#\2 include/' To modify all include lines by adding a space, and then running ./git-clang-format.sh. --- apt-pkg/pkgcache.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 91228f713..acf6cf446 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -74,12 +74,12 @@ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H -#include #include +#include #include -#include #include +#include #ifdef APT_PKG_EXPOSE_STRING_VIEW #include @@ -783,10 +783,13 @@ inline char const * pkgCache::NativeArch() #include -inline pkgCache::GrpIterator pkgCache::GrpBegin() - {return GrpIterator(*this);} -inline pkgCache::GrpIterator pkgCache::GrpEnd() - {return GrpIterator(*this,GrpP);} + inline pkgCache::GrpIterator pkgCache::GrpBegin() + { + return GrpIterator(*this); + } + inline pkgCache::GrpIterator pkgCache::GrpEnd() + { + return GrpIterator(*this, GrpP);} inline pkgCache::PkgIterator pkgCache::PkgBegin() {return PkgIterator(*this);} inline pkgCache::PkgIterator pkgCache::PkgEnd() -- cgit v1.2.3-70-g09d2 From 51da6127d0073c9fc81f4b220f2360bd612ded5c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 12 Jul 2017 14:07:27 +0200 Subject: cacheiterators: Warn about direct include and don't include pkgcache.h This adds a warning so existing working code will still work (as it includes pkgcache.h first anyway), but it will know that it's not right to include this file directly. --- apt-pkg/cacheiterators.h | 4 +++- apt-pkg/pkgcache.h | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index fdc7fbc07..0cb684382 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -29,8 +29,10 @@ /*}}}*/ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H +#ifndef __PKGLIB_IN_PKGCACHE_H +#warning apt-pkg/cacheiterators.h should not be included directly, include apt-pkg/pkgcache.h instead +#endif #include -#include #include #include diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index acf6cf446..e1597c1b1 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -73,7 +73,7 @@ /*}}}*/ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H - +#define __PKGLIB_IN_PKGCACHE_H #include #include @@ -825,4 +825,5 @@ class pkgCache::Namespace /*{{{*/ typedef pkgCache::Flag Flag; }; /*}}}*/ +#undef __PKGLIB_IN_PKGCACHE_H #endif -- cgit v1.2.3-70-g09d2