From: Francesco Chemolli <5175948+kinkie@users.noreply.github.com> Date: Tue, 3 Oct 2023 22:38:02 +0000 (+0000) Subject: Fix "make check" to test headers (#1463) X-Git-Tag: SQUID_7_0_1~339 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a7b75c6498;p=thirdparty%2Fsquid.git Fix "make check" to test headers (#1463) A "make check" testHeaders target is supposed to check that C/C++ header files can be compiled "autonomously" (i.e. without any other code except the required squid.h). Since 2010 commit a0fdc9b, existing testHeaders were not detecting problems in any headers due to a use of a shell heredoc with echo, a command that does not read from standard input. This fix ensures that all C/C++ header files used by "make" are tested in the corresponding "make check". This change also improves parallel testing of individual header files. --- diff --git a/compat/Makefile.am b/compat/Makefile.am index c819834d7d..0943b86569 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -14,8 +14,19 @@ include $(top_srcdir)/src/Common.am # Port Specific Configurations +COMPAT_SSL_ALL_SOURCES = \ + openssl.h + +if ENABLE_SSL +COMPAT_SSL_SOURCES = $(COMPAT_SSL_ALL_SOURCES) +else +COMPAT_SSL_SOURCES = +EXCLUDE_FROM_HDR_TESTING += $(COMPAT_SSL_ALL_SOURCES) +endif + noinst_LTLIBRARIES = libcompatsquid.la libcompatsquid_la_SOURCES = \ + $(COMPAT_SSL_SOURCES) \ assert.cc \ assert.h \ cmsg.h \ @@ -34,7 +45,6 @@ libcompatsquid_la_SOURCES = \ memrchr.cc \ memrchr.h \ mswindows.cc \ - openssl.h \ os/aix.h \ os/android.h \ os/dragonfly.h \ @@ -85,16 +95,3 @@ testPreCompiler_SOURCES = \ testPreCompiler.cc testPreCompiler_LDADD= $(LIBCPPUNIT_LIBS) testPreCompiler_LDFLAGS= - -# os/ subdir prevents us using src/TestHeaders.am -# -TESTS += testHeaders - -## Special Universal .h dependency test script -## aborts if error encountered -testHeaders: $(srcdir)/*.h $(srcdir)/os/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 - -CLEANFILES += testHeaders - -.PHONY: testHeaders diff --git a/configure.ac b/configure.ac index c5c27c5c09..05cc1af3a2 100644 --- a/configure.ac +++ b/configure.ac @@ -1148,6 +1148,7 @@ AS_IF([test "x$with_openssl" = "xyes"],[ openssl/x509v3.h \ openssl/engine.h \ openssl/txt_db.h \ + openssl/pem.h \ ) # User may have provided a custom location for OpenSSL. Otherwise... diff --git a/include/splay.h b/include/splay.h index d1d1fd00fa..8c0f788f42 100644 --- a/include/splay.h +++ b/include/splay.h @@ -10,6 +10,7 @@ #define SQUID_SPLAY_H #include "fatal.h" +#include #include // private class of Splay. Do not use directly diff --git a/lib/Makefile.am b/lib/Makefile.am index edcb0de81a..77e6f48bf7 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -77,12 +77,4 @@ tests_testRFC1738_LDADD= \ tests_testRFC1738_LDFLAGS = $(LIBADD_DL) - -## Special Universal .h dependency test script -## aborts if error encountered testHeaders: $(top_srcdir)/include/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 - -TESTS += testHeaders -CLEANFILES += testHeaders -.PHONY: testHeaders diff --git a/lib/libTrie/Makefile.am b/lib/libTrie/Makefile.am index d3d849bd94..cbd016b9d1 100644 --- a/lib/libTrie/Makefile.am +++ b/lib/libTrie/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS = . test diff --git a/lib/ntlmauth/Makefile.am b/lib/ntlmauth/Makefile.am index 1d65e170de..c44f12c548 100644 --- a/lib/ntlmauth/Makefile.am +++ b/lib/ntlmauth/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am AM_CPPFLAGS += -I$(top_srcdir)/lib diff --git a/lib/sspi/Makefile.am b/lib/sspi/Makefile.am index cfd3453426..30c888b813 100644 --- a/lib/sspi/Makefile.am +++ b/lib/sspi/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libsspwin32.la diff --git a/src/ClientRequestContext.h b/src/ClientRequestContext.h index b4ad460dbf..16c33bba4b 100644 --- a/src/ClientRequestContext.h +++ b/src/ClientRequestContext.h @@ -9,8 +9,10 @@ #ifndef SQUID_CLIENTREQUESTCONTEXT_H #define SQUID_CLIENTREQUESTCONTEXT_H +#include "acl/forward.h" #include "base/RefCount.h" #include "cbdata.h" +#include "defines.h" #include "dns/forward.h" #include "helper/forward.h" #include "ipcache.h" diff --git a/src/Common.am b/src/Common.am index 99a05ac372..647d4ae8b0 100644 --- a/src/Common.am +++ b/src/Common.am @@ -73,3 +73,5 @@ COMPAT_LIB = $(top_builddir)/compat/libcompatsquid.la $(LIBPROFILER) ## Some helpers are written in Perl and need the local shell defined properly subst_perlshell = sed -e 's,[@]PERL[@],$(PERL),g' <$(srcdir)/$@.pl.in >$@ || ($(RM) -f $@ ; exit 1) + +include $(top_srcdir)/src/TestHeaders.am diff --git a/src/DiskIO/AIO/Makefile.am b/src/DiskIO/AIO/Makefile.am index 8890f14b80..4b7db6ec55 100644 --- a/src/DiskIO/AIO/Makefile.am +++ b/src/DiskIO/AIO/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libAIO.la diff --git a/src/DiskIO/Blocking/Makefile.am b/src/DiskIO/Blocking/Makefile.am index 56bfc76398..fd5f785934 100644 --- a/src/DiskIO/Blocking/Makefile.am +++ b/src/DiskIO/Blocking/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libBlocking.la diff --git a/src/DiskIO/DiskDaemon/Makefile.am b/src/DiskIO/DiskDaemon/Makefile.am index 61d4189911..7abfcf628a 100644 --- a/src/DiskIO/DiskDaemon/Makefile.am +++ b/src/DiskIO/DiskDaemon/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libDiskDaemon.la libexec_PROGRAMS = diskd diff --git a/src/DiskIO/DiskThreads/Makefile.am b/src/DiskIO/DiskThreads/Makefile.am index 02ee5f4e6a..c417f1a642 100644 --- a/src/DiskIO/DiskThreads/Makefile.am +++ b/src/DiskIO/DiskThreads/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libDiskThreads.la diff --git a/src/DiskIO/IpcIo/Makefile.am b/src/DiskIO/IpcIo/Makefile.am index 79ddfc635c..21fb099b49 100644 --- a/src/DiskIO/IpcIo/Makefile.am +++ b/src/DiskIO/IpcIo/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libIpcIo.la diff --git a/src/DiskIO/Makefile.am b/src/DiskIO/Makefile.am index a21ebd448d..1e63d62c3e 100644 --- a/src/DiskIO/Makefile.am +++ b/src/DiskIO/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS= diff --git a/src/DiskIO/Mmapped/Makefile.am b/src/DiskIO/Mmapped/Makefile.am index f8b041ca51..f19edadc54 100644 --- a/src/DiskIO/Mmapped/Makefile.am +++ b/src/DiskIO/Mmapped/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libMmapped.la diff --git a/src/HappyConnOpener.h b/src/HappyConnOpener.h index 83946ee257..9e569c71db 100644 --- a/src/HappyConnOpener.h +++ b/src/HappyConnOpener.h @@ -8,10 +8,13 @@ #ifndef SQUID_HAPPYCONNOPENER_H #define SQUID_HAPPYCONNOPENER_H +#include "base/AsyncCallbacks.h" +#include "base/JobWait.h" #include "base/RefCount.h" #include "comm.h" #include "comm/Connection.h" #include "comm/ConnOpener.h" +#include "errorpage.h" #include "http/forward.h" #include "log/forward.h" #include "ResolvedPeers.h" diff --git a/src/HttpUpgradeProtocolAccess.h b/src/HttpUpgradeProtocolAccess.h index 078282a87d..d9d1574faf 100644 --- a/src/HttpUpgradeProtocolAccess.h +++ b/src/HttpUpgradeProtocolAccess.h @@ -12,6 +12,7 @@ #include "acl/forward.h" #include "sbuf/SBuf.h" +#include #include /// a reference to a protocol name[/version] string; no 0-termination is assumed @@ -40,6 +41,8 @@ vAinB(const ProtocolView &a, const ProtocolView &b) return b.version.isEmpty() || (a.version == b.version); } +class ConfigParser; + /// Allows or blocks HTTP Upgrade protocols (see http_upgrade_request_protocols) class HttpUpgradeProtocolAccess { diff --git a/src/Makefile.am b/src/Makefile.am index 26ba97859d..f187ed46f3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,12 +41,14 @@ SNMP_ALL_SOURCE = \ snmp_core.cc \ snmp_agent.h \ snmp_agent.cc + if ENABLE_SNMP SNMP_SOURCE = $(SNMP_ALL_SOURCE) SUBDIRS += snmp SNMP_LIBS = snmp/libsnmp.la $(SNMPLIB) else SNMP_SOURCE = +EXCLUDE_FROM_HDR_TESTING += $(SNMP_ALL_SOURCE) endif if ENABLE_ADAPTATION @@ -100,10 +102,14 @@ if ENABLE_DELAY_POOLS DELAY_POOL_SOURCE = $(DELAY_POOL_ALL_SOURCE) else DELAY_POOL_SOURCE = +EXCLUDE_FROM_HDR_TESTING += $(DELAY_POOL_ALL_SOURCE) endif +KNOWN_HTCP_SOURCE = htcp.cc htcp.h if ENABLE_HTCP -HTCPSOURCE = htcp.cc htcp.h +HTCPSOURCE = $(KNOWN_HTCP_SOURCE) +else +EXCLUDE_FROM_HDR_TESTING += $(KNOWN_HTCP_SOURCE) endif if ENABLE_UNLINKD @@ -772,7 +778,7 @@ check_PROGRAMS += tests/testRandomUuid tests_testRandomUuid_SOURCES = \ tests/testRandomUuid.cc nodist_tests_testRandomUuid_SOURCES = \ - RandomUuid.h \ + base/RandomUuid.h \ tests/stub_debug.cc \ tests/stub_libmem.cc tests_testRandomUuid_LDADD = \ @@ -2745,16 +2751,3 @@ tests_testEventLoop_LDADD = \ $(COMPAT_LIB) \ $(XTRA_LIBS) tests_testEventLoop_LDFLAGS = $(LIBADD_DL) - -## Run the unit tests. check_PROGRAMS only builds the binaries. -TESTS += $(check_PROGRAMS) testHeaders - -## Special Universal .h dependency test script -## aborts if error encountered -testHeaders: $(srcdir)/*.h $(srcdir)/DiskIO/*.h $(srcdir)/DiskIO/*/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 -## src/repl/ has no .h files and its own makefile. - -CLEANFILES += testHeaders -.PHONY: testHeaders - diff --git a/src/MemObject.h b/src/MemObject.h index 6800766240..1e842d2b2b 100644 --- a/src/MemObject.h +++ b/src/MemObject.h @@ -12,6 +12,7 @@ #include "base/DelayedAsyncCalls.h" #include "dlink.h" #include "http/RequestMethod.h" +#include "HttpReply.h" #include "RemovalPolicy.h" #include "SquidString.h" #include "stmem.h" diff --git a/src/NeighborTypeDomainList.h b/src/NeighborTypeDomainList.h index 263e346c4c..0cee01d884 100644 --- a/src/NeighborTypeDomainList.h +++ b/src/NeighborTypeDomainList.h @@ -9,6 +9,8 @@ #ifndef SQUID_NEIGHBORTYPEDOMAINLIST_H_ #define SQUID_NEIGHBORTYPEDOMAINLIST_H_ +#include "enums.h" + /// representation of a neighbor_type_domain configuration directive. A POD class NeighborTypeDomainList { diff --git a/src/NullDelayId.h b/src/NullDelayId.h index 02f29d973c..628a3af595 100644 --- a/src/NullDelayId.h +++ b/src/NullDelayId.h @@ -13,6 +13,7 @@ #if USE_DELAY_POOLS #include "DelayIdComposite.h" +#include "mem/AllocatorProxy.h" class NullDelayId : public DelayIdComposite { diff --git a/src/Pipeline.h b/src/Pipeline.h index 2339802395..54a9e15707 100644 --- a/src/Pipeline.h +++ b/src/Pipeline.h @@ -10,7 +10,7 @@ #define SQUID_SRC_PIPELINE_H #include "base/RefCount.h" -#include "http/forward.h" +#include "http/Stream.h" #include diff --git a/src/ResolvedPeers.h b/src/ResolvedPeers.h index a5ae6d0832..c1125896ca 100644 --- a/src/ResolvedPeers.h +++ b/src/ResolvedPeers.h @@ -10,7 +10,8 @@ #define SQUID_RESOLVEDPEERS_H #include "base/RefCount.h" -#include "comm/forward.h" +#include "comm/Connection.h" +#include "mem/AllocatorProxy.h" #include #include diff --git a/src/SnmpRequest.h b/src/SnmpRequest.h index 3b1403b426..b6e2315a17 100644 --- a/src/SnmpRequest.h +++ b/src/SnmpRequest.h @@ -10,6 +10,8 @@ #define SQUID_SNMPREQUEST_H_ #if SQUID_SNMP +#include "acl/forward.h" +#include "ip/Address.h" #include "snmp_session.h" // POD diff --git a/src/SquidConfig.h b/src/SquidConfig.h index d9ec3d0935..5f1bd5fa79 100644 --- a/src/SquidConfig.h +++ b/src/SquidConfig.h @@ -23,6 +23,7 @@ #include "MessageDelayPools.h" #endif #include "Notes.h" +#include "security/Context.h" #include "security/forward.h" #if USE_OPENSSL #include "ssl/support.h" diff --git a/src/TestHeaders.am b/src/TestHeaders.am index e88a480c44..d2406ddece 100644 --- a/src/TestHeaders.am +++ b/src/TestHeaders.am @@ -5,21 +5,31 @@ ## Please see the COPYING and CONTRIBUTORS files for details. ## -## Test ./*.h files in a directory using test-suite/testheaders.sh +# A space-separated list of header files to be skipped by +# testHeaders during "make check" +EXCLUDE_FROM_HDR_TESTING = -## TODO: include in src/Common.am when all testHeaders users are the same. -TESTS += testHeaders - -## .h dependency test script -## aborts build process on errors; XXX: even with "make -k" -testHeaders: $(srcdir)/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 +# to test header files in addition to those tested by default, +# add an empty target named 'testHeaders' depending on the additional +# headers to test -## XXX: this is only needed because testheaders.sh creates a dummy file called -## testHeaders and distclean does not know about it. -## Remove when testheaders.sh and its users are fixed. -CLEANFILES += testHeaders +testHeaders: $(SOURCES) $(noinst_HEADERS) $(EXTRA_DIST) $(top_srcdir)/test-suite/testHeader.cc.in + $(MAKE) $(^:.h=.hdrtest) && cp $(TRUE) $@ +.h.hdrtest: + @SrcFilePath=`echo $< | $(SED) 's%^$(top_srcdir)/%%'`; \ + SrcFileName=`basename $$SrcFilePath`; \ + TargetFileName=`basename $@`; \ + if test "$(EXCLUDE_FROM_HDR_TESTING)" != "" && echo "$(EXCLUDE_FROM_HDR_TESTING)" | $(TR) ' ' '\n' | $(FGREP) -x -q "$$SrcFileName" ; then \ + echo "header-test: skip - $$SrcFilePath"; \ + exit 0; \ + fi; \ + $(SED) "s%[@]HEADER[@]%${<}%" "$(top_srcdir)/test-suite/testHeader.cc.in" >"$$TargetFileName.cc" && \ + echo "$(CXXCOMPILE) -c -o" "$$TargetFileName" "$$TargetFileName.cc" && \ + if $(CXXCOMPILE) -c -o "$$TargetFileName" "$$TargetFileName.cc" ; \ + then echo "header-test: ok - $$SrcFilePath"; $(RM) "$$TargetFileName.cc" "$$TargetFileName"; \ + else echo "header-test: not ok - $$SrcFilePath"; exit 1; fi -.PHONY: testHeaders +TESTS += testHeaders +CLEANFILES += testHeaders diff --git a/src/acl/Arp.h b/src/acl/Arp.h index 50ebe9f999..a37415635f 100644 --- a/src/acl/Arp.h +++ b/src/acl/Arp.h @@ -10,14 +10,10 @@ #define SQUID_ACLARP_H #include "acl/Acl.h" +#include "eui/Eui48.h" #include -namespace Eui -{ -class Eui48; -}; - /// \ingroup ACLAPI class ACLARP : public ACL { diff --git a/src/acl/Certificate.h b/src/acl/Certificate.h index baadebce85..5d0f546354 100644 --- a/src/acl/Certificate.h +++ b/src/acl/Certificate.h @@ -11,6 +11,7 @@ #include "acl/Data.h" #include "acl/ParameterizedNode.h" +#include "security/forward.h" #include "ssl/support.h" namespace Acl diff --git a/src/acl/CertificateData.h b/src/acl/CertificateData.h index d9622976fa..cd690039a2 100644 --- a/src/acl/CertificateData.h +++ b/src/acl/CertificateData.h @@ -12,6 +12,7 @@ #include "acl/Acl.h" #include "acl/Data.h" #include "acl/StringData.h" +#include "security/forward.h" #include "ssl/support.h" #include #include diff --git a/src/acl/Eui64.h b/src/acl/Eui64.h index ad7363f25a..10c9786291 100644 --- a/src/acl/Eui64.h +++ b/src/acl/Eui64.h @@ -10,14 +10,10 @@ #define SQUID_ACLEUI64_H #include "acl/Acl.h" +#include "eui/Eui64.h" #include -namespace Eui -{ -class Eui64; -}; - class ACLEui64 : public ACL { MEMPROXY_CLASS(ACLEui64); diff --git a/src/acl/Makefile.am b/src/acl/Makefile.am index a2904d664a..6e188ffc65 100644 --- a/src/acl/Makefile.am +++ b/src/acl/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS= external @@ -177,6 +176,8 @@ SSL_ACLS = \ if ENABLE_SSL libacls_la_SOURCES += $(SSL_ACLS) +else +EXCLUDE_FROM_HDR_TESTING += $(SSL_ACLS) endif EXTRA_libacls_la_SOURCES += $(SSL_ACLS) @@ -188,6 +189,8 @@ ADAPT_ACLS= \ if ENABLE_ADAPTATION libacls_la_SOURCES += $(ADAPT_ACLS) +else +EXCLUDE_FROM_HDR_TESTING += $(ADAPT_ACLS) endif EXTRA_libacls_la_SOURCES += $(ADAPT_ACLS) @@ -195,5 +198,7 @@ ARP_ACLS = Arp.cc Arp.h Eui64.cc Eui64.h if ENABLE_EUI libacls_la_SOURCES += $(ARP_ACLS) +else +EXCLUDE_FROM_HDR_TESTING += $(ARP_ACLS) endif EXTRA_libacls_la_SOURCES += $(ARP_ACLS) diff --git a/src/acl/ServerCertificate.h b/src/acl/ServerCertificate.h index a25d641d62..9c195aed23 100644 --- a/src/acl/ServerCertificate.h +++ b/src/acl/ServerCertificate.h @@ -11,6 +11,7 @@ #include "acl/Data.h" #include "acl/ParameterizedNode.h" +#include "security/forward.h" #include "ssl/support.h" namespace Acl diff --git a/src/acl/SourceDomain.h b/src/acl/SourceDomain.h index 2a32792364..854d1a2eeb 100644 --- a/src/acl/SourceDomain.h +++ b/src/acl/SourceDomain.h @@ -9,6 +9,7 @@ #ifndef SQUID_ACLSOURCEDOMAIN_H #define SQUID_ACLSOURCEDOMAIN_H +#include "acl/Checklist.h" #include "acl/Data.h" #include "acl/ParameterizedNode.h" #include "dns/forward.h" diff --git a/src/adaptation/Makefile.am b/src/adaptation/Makefile.am index 87fa8bead7..f9da5c42ca 100644 --- a/src/adaptation/Makefile.am +++ b/src/adaptation/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS = diff --git a/src/adaptation/ecap/Makefile.am b/src/adaptation/ecap/Makefile.am index 7b0dd59969..9045a0c0a8 100644 --- a/src/adaptation/ecap/Makefile.am +++ b/src/adaptation/ecap/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libecapsquid.la diff --git a/src/adaptation/icap/Makefile.am b/src/adaptation/icap/Makefile.am index bc5a2953a0..bb6be60414 100644 --- a/src/adaptation/icap/Makefile.am +++ b/src/adaptation/icap/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libicap.la diff --git a/src/anyp/Makefile.am b/src/anyp/Makefile.am index 7913dcbc7e..62c720e2d5 100644 --- a/src/anyp/Makefile.am +++ b/src/anyp/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libanyp.la diff --git a/src/auth/Makefile.am b/src/auth/Makefile.am index be458c9da1..560bf3dadd 100644 --- a/src/auth/Makefile.am +++ b/src/auth/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS = $(AUTH_MODULES) DIST_SUBDIRS = basic digest negotiate ntlm diff --git a/src/auth/QueueNode.h b/src/auth/QueueNode.h index 128862651a..eba51701e9 100644 --- a/src/auth/QueueNode.h +++ b/src/auth/QueueNode.h @@ -9,8 +9,9 @@ #ifndef SQUID_SRC_AUTH_QUEUENODE_H #define SQUID_SRC_AUTH_QUEUENODE_H -#include "auth/forward.h" +#include "auth/UserRequest.h" #include "cbdata.h" +#include "mem/AllocatorProxy.h" namespace Auth { diff --git a/src/auth/basic/Makefile.am b/src/auth/basic/Makefile.am index f84cbbed91..54bdc47588 100644 --- a/src/auth/basic/Makefile.am +++ b/src/auth/basic/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am DIST_SUBDIRS = \ DB \ diff --git a/src/auth/digest/Makefile.am b/src/auth/digest/Makefile.am index cc2b9b6519..0c74ad7d28 100644 --- a/src/auth/digest/Makefile.am +++ b/src/auth/digest/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am DIST_SUBDIRS= eDirectory file LDAP SUBDIRS= $(DIGEST_AUTH_HELPERS) diff --git a/src/auth/digest/UserRequest.h b/src/auth/digest/UserRequest.h index 16433585b4..a569cb22c8 100644 --- a/src/auth/digest/UserRequest.h +++ b/src/auth/digest/UserRequest.h @@ -11,6 +11,7 @@ #if HAVE_AUTH_MODULE_DIGEST +#include "auth/digest/Config.h" #include "auth/UserRequest.h" class ConnStateData; diff --git a/src/auth/digest/eDirectory/edir_ldapext.h b/src/auth/digest/eDirectory/edir_ldapext.h index 2a8051122a..e882dc82db 100644 --- a/src/auth/digest/eDirectory/edir_ldapext.h +++ b/src/auth/digest/eDirectory/edir_ldapext.h @@ -6,5 +6,9 @@ * Please see the COPYING and CONTRIBUTORS files for details. */ +#if HAVE_LDAP_H +#include +#endif + int nds_get_password(LDAP *ld, char *object_dn, size_t * pwd_len, char *pwd); diff --git a/src/auth/forward.h b/src/auth/forward.h index cf977b88a9..bc4dfc2c35 100644 --- a/src/auth/forward.h +++ b/src/auth/forward.h @@ -23,6 +23,8 @@ class Scheme; class SchemeConfig; typedef std::vector ConfigVector; +class UserRequest; + } // namespace Auth #endif /* USE_AUTH */ diff --git a/src/auth/negotiate/Makefile.am b/src/auth/negotiate/Makefile.am index 935bba2f4d..558fe3932a 100644 --- a/src/auth/negotiate/Makefile.am +++ b/src/auth/negotiate/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am DIST_SUBDIRS= kerberos SSPI wrapper SUBDIRS= $(NEGOTIATE_AUTH_HELPERS) diff --git a/src/auth/ntlm/Makefile.am b/src/auth/ntlm/Makefile.am index c0f8c280b0..b2a1176f70 100644 --- a/src/auth/ntlm/Makefile.am +++ b/src/auth/ntlm/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am DIST_SUBDIRS= fake SMB_LM SSPI SUBDIRS= $(NTLM_AUTH_HELPERS) diff --git a/src/base/AsyncCall.h b/src/base/AsyncCall.h index 3dc638ee69..7e1afb1ff2 100644 --- a/src/base/AsyncCall.h +++ b/src/base/AsyncCall.h @@ -10,6 +10,7 @@ #define SQUID_ASYNCCALL_H #include "base/CodeContext.h" +#include "base/forward.h" #include "base/InstanceId.h" #include "event.h" #include "RefCount.h" @@ -39,7 +40,7 @@ class CallDialer; class AsyncCall: public RefCountable { public: - typedef RefCount Pointer; + using Pointer = AsyncCallPointer; AsyncCall(int aDebugSection, int aDebugLevel, const char *aName); ~AsyncCall() override; diff --git a/src/base/AsyncCallList.h b/src/base/AsyncCallList.h index 8c0941c630..36dda7b464 100644 --- a/src/base/AsyncCallList.h +++ b/src/base/AsyncCallList.h @@ -9,7 +9,7 @@ #ifndef SQUID_BASE_ASYNCCALLLIST_H #define SQUID_BASE_ASYNCCALLLIST_H -#include "base/forward.h" +#include "base/AsyncCall.h" #include "base/RefCount.h" /// An efficient (but intrusive) AsyncCall storage preserving FIFO order. diff --git a/src/base/Makefile.am b/src/base/Makefile.am index 37c1d32d06..ba18de1f8c 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libbase.la @@ -69,6 +68,7 @@ libbase_la_SOURCES = \ SupportOrVeto.h \ TextException.cc \ TextException.h \ + ToCpp.h \ TypeTraits.h \ YesNoNone.h \ forward.h diff --git a/src/base/ToCpp.h b/src/base/ToCpp.h new file mode 100644 index 0000000000..ab1ff98f19 --- /dev/null +++ b/src/base/ToCpp.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 1996-2023 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +#ifndef SQUID_SRC_BASE_TOCPP_H +#define SQUID_SRC_BASE_TOCPP_H + +/// Defines a C++ equivalent of an extern "C" function. +/// The defined C++ function name uses a _cpp suffix. +#define CtoCpp1(function, argument) \ + extern "C++" inline void function##_cpp(argument a) \ + { \ + function(a); \ + } + +#endif /* SQUID_SRC_BASE_TOCPP_H */ + diff --git a/src/clients/HttpTunnelerAnswer.h b/src/clients/HttpTunnelerAnswer.h index 50018d690e..90237c465d 100644 --- a/src/clients/HttpTunnelerAnswer.h +++ b/src/clients/HttpTunnelerAnswer.h @@ -10,7 +10,7 @@ #define SQUID_SRC_CLIENTS_HTTP_TUNNELERANSWER_H #include "base/CbcPointer.h" -#include "comm/forward.h" +#include "comm/Connection.h" #include "http/StatusCode.h" #include "sbuf/SBuf.h" diff --git a/src/clients/Makefile.am b/src/clients/Makefile.am index 2bee0ee64b..1ee7af5d76 100644 --- a/src/clients/Makefile.am +++ b/src/clients/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libclients.la diff --git a/src/comm/Makefile.am b/src/comm/Makefile.am index d8c63c447d..630a238476 100644 --- a/src/comm/Makefile.am +++ b/src/comm/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = \ libcomm.la \ diff --git a/src/debug/Makefile.am b/src/debug/Makefile.am index 7d8fe77e4b..c2b1110590 100644 --- a/src/debug/Makefile.am +++ b/src/debug/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libdebug.la diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am index 84de533cc2..b5e4df89a1 100644 --- a/src/dns/Makefile.am +++ b/src/dns/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libdns.la diff --git a/src/error/Makefile.am b/src/error/Makefile.am index a1d5d65f79..ad09fc1549 100644 --- a/src/error/Makefile.am +++ b/src/error/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am categories.cc: forward.h $(top_srcdir)/src/mk-string-arrays.awk $(AWK) -f $(top_srcdir)/src/mk-string-arrays.awk ifile=error/forward.h < $(srcdir)/forward.h > $@ || ($(RM) -f $@ && exit 1) diff --git a/src/esi/Context.h b/src/esi/Context.h index fd44d863c2..73f7047093 100644 --- a/src/esi/Context.h +++ b/src/esi/Context.h @@ -16,6 +16,7 @@ #include "esi/Parser.h" #include "http/forward.h" #include "http/StatusCode.h" +#include "HttpReply.h" class ESIVarState; class ClientHttpRequest; diff --git a/src/esi/Include.h b/src/esi/Include.h index d0dc527ade..b5060a8313 100644 --- a/src/esi/Include.h +++ b/src/esi/Include.h @@ -14,6 +14,7 @@ #include "esi/Context.h" #include "esi/Element.h" #include "esi/Segment.h" +#include "HttpHeader.h" class ESIInclude; typedef RefCount ESIIncludePtr; diff --git a/src/esi/Makefile.am b/src/esi/Makefile.am index acd4a6b3df..3c73fcd430 100644 --- a/src/esi/Makefile.am +++ b/src/esi/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libesi.la diff --git a/src/eui/Makefile.am b/src/eui/Makefile.am index e6c0b6c854..13c37a55bc 100644 --- a/src/eui/Makefile.am +++ b/src/eui/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libeui.la diff --git a/src/format/Makefile.am b/src/format/Makefile.am index 195d6f4198..17e7622feb 100644 --- a/src/format/Makefile.am +++ b/src/format/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libformat.la diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am index 8ee268713f..564932494e 100644 --- a/src/fs/Makefile.am +++ b/src/fs/Makefile.am @@ -65,17 +65,3 @@ ufs/clean: clean rock/all: librock.la rock/clean: clean - -TESTS += testHeaders - -## Special Universal .h dependency test script -## aborts if error encountered -testHeaders: $(srcdir)/ufs/*.h $(srcdir)/rock/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 -## diskd/ has no .h files -## aufs/ has no .h files -## ./ has no .h files - -CLEANFILES += testHeaders - -.PHONY: testHeaders diff --git a/src/fs/ufs/UFSStoreState.h b/src/fs/ufs/UFSStoreState.h index b252410cda..296bdaad77 100644 --- a/src/fs/ufs/UFSStoreState.h +++ b/src/fs/ufs/UFSStoreState.h @@ -9,6 +9,7 @@ #ifndef SQUID_FS_UFS_UFSSTORESTATE_H #define SQUID_FS_UFS_UFSSTORESTATE_H +#include "DiskIO/DiskFile.h" #include "DiskIO/IORequestor.h" #include "StoreIOState.h" diff --git a/src/ftp/Makefile.am b/src/ftp/Makefile.am index c05da1f5fc..5c5874e84f 100644 --- a/src/ftp/Makefile.am +++ b/src/ftp/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libftp.la diff --git a/src/helper/Makefile.am b/src/helper/Makefile.am index 54246148d2..4d7e9c50b3 100644 --- a/src/helper/Makefile.am +++ b/src/helper/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libhelper.la diff --git a/src/helper/Request.h b/src/helper/Request.h index f9cea94ba7..ec86d77809 100644 --- a/src/helper/Request.h +++ b/src/helper/Request.h @@ -9,7 +9,9 @@ #ifndef _SQUID_SRC_HELPER_REQUEST_H #define _SQUID_SRC_HELPER_REQUEST_H +#include "cbdata.h" #include "helper/forward.h" +#include "mem/AllocatorProxy.h" #include "time/gadgets.h" namespace Helper diff --git a/src/htcp.h b/src/htcp.h index 159a6bdd75..b4c02cfe84 100644 --- a/src/htcp.h +++ b/src/htcp.h @@ -11,6 +11,7 @@ #if USE_HTCP +#include "enums.h" #include "http/forward.h" #include "HttpHeader.h" #include "ip/forward.h" @@ -45,6 +46,8 @@ void neighborsHtcpReply(const cache_key *, HtcpReplyData *, const Ip::Address &) /// \ingroup ServerProtocolHTCP void htcpOpenPorts(void); +class CachePeer; + /** * \ingroup ServerProtocolHTCP * diff --git a/src/http/Makefile.am b/src/http/Makefile.am index 492fb23e73..a976b2024d 100644 --- a/src/http/Makefile.am +++ b/src/http/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS = one url_rewriters diff --git a/src/http/Stream.h b/src/http/Stream.h index e0d2abef2e..9708e8e1b9 100644 --- a/src/http/Stream.h +++ b/src/http/Stream.h @@ -9,16 +9,19 @@ #ifndef SQUID_SRC_HTTP_STREAM_H #define SQUID_SRC_HTTP_STREAM_H +#include "clientStreamForward.h" +#include "comm/forward.h" +#include "debug/Stream.h" +#include "error/Error.h" #include "http/forward.h" +#include "log/forward.h" #include "mem/forward.h" +#include "servers/forward.h" #include "StoreIOBuffer.h" #if USE_DELAY_POOLS #include "MessageBucket.h" #endif -class clientStreamNode; -class ClientHttpRequest; - namespace Http { diff --git a/src/http/one/Makefile.am b/src/http/one/Makefile.am index d0524059ef..e196047cdb 100644 --- a/src/http/one/Makefile.am +++ b/src/http/one/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libhttp1.la diff --git a/src/icmp/Makefile.am b/src/icmp/Makefile.am index 39b4030c8e..daa516b287 100644 --- a/src/icmp/Makefile.am +++ b/src/icmp/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am # ICMP Specific Configurations diff --git a/src/ident/Makefile.am b/src/ident/Makefile.am index e98478e8ff..519cd6f719 100644 --- a/src/ident/Makefile.am +++ b/src/ident/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libident.la diff --git a/src/ip/Intercept.h b/src/ip/Intercept.h index 02a5129856..e55cd82b1f 100644 --- a/src/ip/Intercept.h +++ b/src/ip/Intercept.h @@ -11,6 +11,8 @@ #ifndef SQUID_IP_IPINTERCEPT_H #define SQUID_IP_IPINTERCEPT_H +#include "comm/forward.h" + namespace Ip { diff --git a/src/ip/Makefile.am b/src/ip/Makefile.am index 30967f8404..5f64a97faa 100644 --- a/src/ip/Makefile.am +++ b/src/ip/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libip.la diff --git a/src/ip/NfMarkConfig.h b/src/ip/NfMarkConfig.h index 6aa90610e7..6e2c6ed3a7 100644 --- a/src/ip/NfMarkConfig.h +++ b/src/ip/NfMarkConfig.h @@ -11,6 +11,8 @@ #include "ip/forward.h" +#include + class SBuf; namespace Ip diff --git a/src/ip/QosConfig.h b/src/ip/QosConfig.h index 5a30e1df59..613aa0a198 100644 --- a/src/ip/QosConfig.h +++ b/src/ip/QosConfig.h @@ -10,6 +10,8 @@ #define SQUID_QOSCONFIG_H #include "acl/forward.h" +#include "cbdata.h" +#include "comm/forward.h" #include "hier_code.h" #include "ip/forward.h" #include "ip/NfMarkConfig.h" diff --git a/src/ipc/Makefile.am b/src/ipc/Makefile.am index e268fe2c1e..29c1feab97 100644 --- a/src/ipc/Makefile.am +++ b/src/ipc/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libipc.la diff --git a/src/ipc/Response.h b/src/ipc/Response.h index 51562d96c1..1aed2c1e05 100644 --- a/src/ipc/Response.h +++ b/src/ipc/Response.h @@ -13,8 +13,8 @@ #include "base/RefCount.h" #include "base/TypeTraits.h" -#include "ipc/forward.h" #include "ipc/QuestionerId.h" +#include "ipc/RequestId.h" namespace Ipc { diff --git a/src/ipc/SharedListen.h b/src/ipc/SharedListen.h index 3f1ac05449..7a5d912799 100644 --- a/src/ipc/SharedListen.h +++ b/src/ipc/SharedListen.h @@ -13,6 +13,7 @@ #include "base/AsyncCall.h" #include "base/Subscription.h" +#include "ip/Address.h" #include "ipc/QuestionerId.h" #include "ipc/RequestId.h" #include "ipc/StartListening.h" diff --git a/src/log/Makefile.am b/src/log/Makefile.am index 8b8e0637d1..44e870bf61 100644 --- a/src/log/Makefile.am +++ b/src/log/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am DIST_SUBDIRS= DB file SUBDIRS= $(LOG_DAEMON_HELPERS) diff --git a/src/log/TcpLogger.h b/src/log/TcpLogger.h index abd4a235e2..0347a6fc39 100644 --- a/src/log/TcpLogger.h +++ b/src/log/TcpLogger.h @@ -13,9 +13,13 @@ #include "base/JobWait.h" #include "comm/forward.h" #include "ip/Address.h" +#include "log/forward.h" #include +class CommCloseCbParams; +class CommConnectCbParams; +class CommIoCbParams; class MemBlob; typedef RefCount MemBlobPointer; diff --git a/src/mem/Makefile.am b/src/mem/Makefile.am index 7e34f3bed4..d2faac9963 100644 --- a/src/mem/Makefile.am +++ b/src/mem/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = \ libmem.la \ diff --git a/src/mgr/Filler.h b/src/mgr/Filler.h index 490d294c4f..10e31c1496 100644 --- a/src/mgr/Filler.h +++ b/src/mgr/Filler.h @@ -12,7 +12,7 @@ #define SQUID_MGR_FILLER_H #include "comm/forward.h" -#include "ipc/forward.h" +#include "ipc/RequestId.h" #include "mgr/Action.h" #include "mgr/StoreToCommWriter.h" diff --git a/src/mgr/Makefile.am b/src/mgr/Makefile.am index e1c44afeab..0771ce3699 100644 --- a/src/mgr/Makefile.am +++ b/src/mgr/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libmgr.la diff --git a/src/mgr/Request.h b/src/mgr/Request.h index 21a89fce7b..d917da050a 100644 --- a/src/mgr/Request.h +++ b/src/mgr/Request.h @@ -11,6 +11,7 @@ #ifndef SQUID_MGR_REQUEST_H #define SQUID_MGR_REQUEST_H +#include "comm/forward.h" #include "ipc/forward.h" #include "ipc/Request.h" #include "mgr/ActionParams.h" diff --git a/src/parser/Makefile.am b/src/parser/Makefile.am index 176835a916..7ed1a0d5c5 100644 --- a/src/parser/Makefile.am +++ b/src/parser/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libparser.la diff --git a/src/proxyp/Makefile.am b/src/proxyp/Makefile.am index 8b2fa1bfd4..f03c87c55d 100644 --- a/src/proxyp/Makefile.am +++ b/src/proxyp/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libproxyp.la diff --git a/src/refresh.h b/src/refresh.h index 46832a1bd2..e2727132d6 100644 --- a/src/refresh.h +++ b/src/refresh.h @@ -11,7 +11,8 @@ #ifndef SQUID_REFRESH_H_ #define SQUID_REFRESH_H_ -class RefreshPattern; +#include "http/forward.h" +#include "store/forward.h" void refreshAddToList(const char *, int, time_t, int, time_t); bool refreshIsCachable(const StoreEntry *); @@ -21,6 +22,8 @@ int refreshCheckHTCP(const StoreEntry *, HttpRequest *); int refreshCheckDigest(const StoreEntry *, time_t delta); time_t getMaxAge(const char *url); void refreshInit(void); + +class RefreshPattern; const RefreshPattern *refreshLimits(const char *url); #endif /* SQUID_REFRESH_H_ */ diff --git a/src/repl/Makefile.am b/src/repl/Makefile.am index e8d9e0299f..5af3e37202 100644 --- a/src/repl/Makefile.am +++ b/src/repl/Makefile.am @@ -21,16 +21,3 @@ libheap_a_SOURCES = \ heap/store_heap_replacement.h \ heap/store_repl_heap.cc - -## Until such time as we have a makefile in src/repl/heap etc. -TESTS += testHeaders - -## Special Universal .h dependency test script -## aborts if error encountered -testHeaders: $(srcdir)/heap/*.h - $(SHELL) $(top_srcdir)/test-suite/testheaders.sh "$(CXXCOMPILE)" $^ || exit 1 -## ./ has no .h files. -## ./lru/ has no .h files. - -CLEANFILES += testHeaders -.PHONY: testHeaders diff --git a/src/sbuf/Makefile.am b/src/sbuf/Makefile.am index b265faa5aa..f36558e37d 100644 --- a/src/sbuf/Makefile.am +++ b/src/sbuf/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libsbuf.la diff --git a/src/security/BlindPeerConnector.h b/src/security/BlindPeerConnector.h index c2f1a712ca..62e19c77f5 100644 --- a/src/security/BlindPeerConnector.h +++ b/src/security/BlindPeerConnector.h @@ -9,6 +9,8 @@ #ifndef SQUID_SRC_SECURITY_BLINDPEERCONNECTOR_H #define SQUID_SRC_SECURITY_BLINDPEERCONNECTOR_H +#include "http/forward.h" +#include "HttpRequest.h" #include "security/PeerConnector.h" class ErrorState; diff --git a/src/security/Certificate.h b/src/security/Certificate.h index 04803b4e78..06c4a609ff 100644 --- a/src/security/Certificate.h +++ b/src/security/Certificate.h @@ -9,6 +9,7 @@ #ifndef SQUID_SRC_SECURITY_CERTIFICATE_H #define SQUID_SRC_SECURITY_CERTIFICATE_H +#include "sbuf/forward.h" #include "security/forward.h" // The accessing/testing functions below require a non-constant Certificate when diff --git a/src/security/CommunicationSecrets.h b/src/security/CommunicationSecrets.h index e802c81ada..42b734c6b3 100644 --- a/src/security/CommunicationSecrets.h +++ b/src/security/CommunicationSecrets.h @@ -10,7 +10,7 @@ #define SQUID_SRC_SECURITY_COMMUNICATION_SECRETS_H #include "sbuf/SBuf.h" -#include "security/forward.h" +#include "security/Session.h" #include diff --git a/src/security/EncryptorAnswer.h b/src/security/EncryptorAnswer.h index 3ba646dc6f..2b9515dc36 100644 --- a/src/security/EncryptorAnswer.h +++ b/src/security/EncryptorAnswer.h @@ -10,7 +10,7 @@ #define SQUID_SECURITY_ENCRYPTORANSWER_H #include "base/CbcPointer.h" -#include "comm/forward.h" +#include "comm/Connection.h" class ErrorState; diff --git a/src/security/LockingPointer.h b/src/security/LockingPointer.h index 60b4d05dd6..99b4d623f4 100644 --- a/src/security/LockingPointer.h +++ b/src/security/LockingPointer.h @@ -28,13 +28,6 @@ #endif /* USE_OPENSSL */ -// Macro to be used to define the C++ equivalent function of an extern "C" -// function. The C++ function suffixed with the _cpp extension -#define CtoCpp1(function, argument) \ - extern "C++" inline void function ## _cpp(argument a) { \ - function(a); \ - } - namespace Security { diff --git a/src/security/Makefile.am b/src/security/Makefile.am index 18416f44c1..df152d5a99 100644 --- a/src/security/Makefile.am +++ b/src/security/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS= cert_generators cert_validators diff --git a/src/security/PeerOptions.h b/src/security/PeerOptions.h index 72ca02635c..7aed44e5bd 100644 --- a/src/security/PeerOptions.h +++ b/src/security/PeerOptions.h @@ -11,8 +11,10 @@ #include "base/YesNoNone.h" #include "ConfigParser.h" +#include "security/Context.h" #include "security/forward.h" #include "security/KeyData.h" +#include "security/Session.h" class Packable; diff --git a/src/security/Session.h b/src/security/Session.h index 2fcc9c1750..127f87a76f 100644 --- a/src/security/Session.h +++ b/src/security/Session.h @@ -11,7 +11,7 @@ #include "base/HardFun.h" #include "comm/forward.h" -#include "security/forward.h" +#include "security/Context.h" #include "security/LockingPointer.h" #include diff --git a/src/security/cert_generators/file/Makefile.am b/src/security/cert_generators/file/Makefile.am index 821c2dcc18..070dc95e60 100644 --- a/src/security/cert_generators/file/Makefile.am +++ b/src/security/cert_generators/file/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am include $(top_srcdir)/doc/manuals/Substitute.am security_file_certgen.8: $(srcdir)/security_file_certgen.8.in Makefile diff --git a/src/security/forward.h b/src/security/forward.h index 57191ddfd0..10cf9b3afa 100644 --- a/src/security/forward.h +++ b/src/security/forward.h @@ -11,14 +11,15 @@ #include "base/CbDataList.h" #include "base/forward.h" -#include "security/Context.h" -#include "security/Session.h" +#include "base/ToCpp.h" +#include "security/LockingPointer.h" #if USE_GNUTLS && HAVE_GNUTLS_ABSTRACT_H #include #endif #include #include +#include #if USE_OPENSSL #include "compat/openssl.h" #if HAVE_OPENSSL_BN_H @@ -30,6 +31,9 @@ #if HAVE_OPENSSL_RSA_H #include #endif +#if HAVE_OPENSSL_X509_H +#include +#endif #endif /* USE_OPENSSL */ #include diff --git a/src/servers/FtpServer.h b/src/servers/FtpServer.h index 084d0d4323..4f6ab9264b 100644 --- a/src/servers/FtpServer.h +++ b/src/servers/FtpServer.h @@ -15,6 +15,7 @@ #include "base/Lock.h" #include "client_side.h" #include "comm/forward.h" +#include "http/forward.h" namespace Ftp { diff --git a/src/servers/Http1Server.h b/src/servers/Http1Server.h index 4e840ca552..e97a1f3335 100644 --- a/src/servers/Http1Server.h +++ b/src/servers/Http1Server.h @@ -9,6 +9,9 @@ #ifndef SQUID_SRC_SERVERS_HTTP1SERVER_H #define SQUID_SRC_SERVERS_HTTP1SERVER_H +#include "client_side.h" +#include "http/one/RequestParser.h" +#include "http/Stream.h" #include "servers/forward.h" namespace Http diff --git a/src/servers/Makefile.am b/src/servers/Makefile.am index 769f8e806a..67d85a53a5 100644 --- a/src/servers/Makefile.am +++ b/src/servers/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libservers.la diff --git a/src/servers/Server.h b/src/servers/Server.h index f890584477..01cfae1eff 100644 --- a/src/servers/Server.h +++ b/src/servers/Server.h @@ -17,6 +17,8 @@ #include "BodyPipe.h" #include "comm/Write.h" #include "CommCalls.h" +#include "error/forward.h" +#include "http/Stream.h" #include "log/forward.h" #include "Pipeline.h" #include "sbuf/SBuf.h" diff --git a/src/servers/forward.h b/src/servers/forward.h index 3961b89f3c..dd08ae1a03 100644 --- a/src/servers/forward.h +++ b/src/servers/forward.h @@ -24,7 +24,7 @@ class Server; } // namespace One /// create a new HTTP connection handler; never returns NULL -ConnStateData *NewServer(const MasterXaction::Pointer &xact); +ConnStateData *NewServer(const MasterXactionPointer &xact); } // namespace Http @@ -32,7 +32,7 @@ namespace Https { /// create a new HTTPS connection handler; never returns NULL -ConnStateData *NewServer(const MasterXaction::Pointer &xact); +ConnStateData *NewServer(const MasterXactionPointer &xact); } // namespace Https diff --git a/src/snmp/Forwarder.h b/src/snmp/Forwarder.h index 2932c44971..34bd70e78a 100644 --- a/src/snmp/Forwarder.h +++ b/src/snmp/Forwarder.h @@ -11,6 +11,7 @@ #ifndef SQUID_SNMPX_FORWARDER_H #define SQUID_SNMPX_FORWARDER_H +#include "ip/forward.h" #include "ipc/Forwarder.h" #include "snmp/Pdu.h" #include "snmp/Session.h" diff --git a/src/snmp/Makefile.am b/src/snmp/Makefile.am index d01733cf52..70046285e1 100644 --- a/src/snmp/Makefile.am +++ b/src/snmp/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libsnmp.la diff --git a/src/snmp_core.h b/src/snmp_core.h index 3f67c4fe1b..5b0f1e8474 100644 --- a/src/snmp_core.h +++ b/src/snmp_core.h @@ -16,6 +16,7 @@ #include "cache_snmp.h" #include "comm/forward.h" #include "ip/forward.h" +#include "snmp_vars.h" class MemBuf; diff --git a/src/ssl/Makefile.am b/src/ssl/Makefile.am index 58c46e9f09..9d252a999b 100644 --- a/src/ssl/Makefile.am +++ b/src/ssl/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libsslsquid.la libsslutil.la diff --git a/src/ssl/context_storage.h b/src/ssl/context_storage.h index bfc5ce408b..ed2968a3dd 100644 --- a/src/ssl/context_storage.h +++ b/src/ssl/context_storage.h @@ -17,7 +17,7 @@ #include "ip/Address.h" #include "mgr/Action.h" #include "mgr/Command.h" -#include "security/forward.h" +#include "security/Context.h" #include "ssl/gadgets.h" #include diff --git a/src/ssl/gadgets.h b/src/ssl/gadgets.h index be1e6c6320..b4a6969513 100644 --- a/src/ssl/gadgets.h +++ b/src/ssl/gadgets.h @@ -21,6 +21,9 @@ #if HAVE_OPENSSL_ASN1_H #include #endif +#if HAVE_OPENSSL_PEM_H +#include +#endif #if HAVE_OPENSSL_TXT_DB_H #include #endif diff --git a/src/ssl/support.h b/src/ssl/support.h index 3e134510c9..9750416d5f 100644 --- a/src/ssl/support.h +++ b/src/ssl/support.h @@ -17,7 +17,7 @@ #include "comm/forward.h" #include "compat/openssl.h" #include "sbuf/SBuf.h" -#include "security/forward.h" +#include "security/Session.h" #include "ssl/gadgets.h" #if HAVE_OPENSSL_X509V3_H diff --git a/src/store/Makefile.am b/src/store/Makefile.am index 1830f42eae..4fbfc1e341 100644 --- a/src/store/Makefile.am +++ b/src/store/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am SUBDIRS= id_rewriters diff --git a/src/store/SwapMetaOut.h b/src/store/SwapMetaOut.h index b225df4ad2..0d219d965d 100644 --- a/src/store/SwapMetaOut.h +++ b/src/store/SwapMetaOut.h @@ -10,14 +10,14 @@ #define SQUID_SRC_STORE_SWAPMETAOUT_H #include "base/HardFun.h" +#include "base/ToCpp.h" #include "store/forward.h" #include -// TODO: Use CtoCpp1() from security/LockingPointer.h by moving that into base/ToCpp.h or similar. /// C++ wrapper for the legacy xmalloc()/xcalloc() deallocator /// \sa xfree_cppwrapper() with a slightly different (FREE-matching) signature. -extern "C++" inline void xfree_cpp(const void * const x) { xfree(x); } +CtoCpp1(xfree, const void *) // TODO: Move AllocedBuf and xfree_cpp() to src/base/Memory.h or similar. /// memory allocated by xmalloc() or xcalloc(), to be freed by xfree() diff --git a/src/store/SwapMetaView.h b/src/store/SwapMetaView.h index 4956869be9..c8c5ed8b75 100644 --- a/src/store/SwapMetaView.h +++ b/src/store/SwapMetaView.h @@ -9,6 +9,7 @@ #ifndef SQUID_SRC_STORE_SWAPMETAVIEW_H #define SQUID_SRC_STORE_SWAPMETAVIEW_H +#include "base/TextException.h" #include "store/SwapMeta.h" #include diff --git a/src/time/Makefile.am b/src/time/Makefile.am index 6a6b19cc0d..c14e5de477 100644 --- a/src/time/Makefile.am +++ b/src/time/Makefile.am @@ -6,7 +6,6 @@ ## include $(top_srcdir)/src/Common.am -include $(top_srcdir)/src/TestHeaders.am noinst_LTLIBRARIES = libtime.la diff --git a/src/whois.h b/src/whois.h index 6977ad0ea7..35d40caaaf 100644 --- a/src/whois.h +++ b/src/whois.h @@ -11,6 +11,8 @@ #ifndef SQUID_WHOIS_H_ #define SQUID_WHOIS_H_ +#include "clients/forward.h" + /** * \defgroup ServerProtocolWhoisAPI Server-Side WHOIS API * \ingroup ServerProtocol diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index 8becdbcb24..b46d3851b4 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -25,7 +25,7 @@ EXTRA_DIST = \ test-functionality.sh \ test-sources.sh \ test-squid-conf.sh \ - testheaders.sh + testHeader.cc.in ESI_ALL_TESTS = \ ESIExpressions diff --git a/test-suite/testHeader.cc.in b/test-suite/testHeader.cc.in new file mode 100644 index 0000000000..0e8577ba0d --- /dev/null +++ b/test-suite/testHeader.cc.in @@ -0,0 +1,21 @@ +/* + * Copyright (C) 1996-2023 The Squid Software Foundation and contributors + * + * Squid software is distributed under GPLv2+ license and includes + * contributions from numerous individuals and organizations. + * Please see the COPYING and CONTRIBUTORS files for details. + */ + +/* + * This file is used to test whether Squid header files can be compiled on their own. + * See the testHeaders target in src/TestHeaders.am. + */ + +#include "squid.h" +#include "@HEADER@" + +int +main(int, char **) { + return 0; +} + diff --git a/test-suite/testheaders.sh b/test-suite/testheaders.sh deleted file mode 100755 index 86edf4ea9c..0000000000 --- a/test-suite/testheaders.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -## Copyright (C) 1996-2023 The Squid Software Foundation and contributors -## -## Squid software is distributed under GPLv2+ license and includes -## contributions from numerous individuals and organizations. -## Please see the COPYING and CONTRIBUTORS files for details. -## - -# test all header files (.h) for dependency issues. -# -# Ideally this test should be performed twice before any code is accepted. -# With or without inline enabled. This is needed because the .cci files -# are only included into the .h files when inline mode is enabled. -# -# This script should be run from the makefile with the directory path and ccflags -# -cc="${1}" -shift -for dir in /usr/bin /usr/local/bin /usr/gnu/bin -do - test -x ${dir}/true && TRUE=${dir}/true -done -TRUE=${TRUE:-/bin/true} - -exitCode=0 - -for f in $@; do - echo -n "Testing ${f} ..." - t="testhdr_`basename ${f}`" - if [ ! -f "$t.o" -o $f -nt "$t.o" ]; then - echo >$t.cc <