master
1#!/usr/bin/env perl
2#***************************************************************************
3# _ _ ____ _
4# Project ___| | | | _ \| |
5# / __| | | | |_) | |
6# | (__| |_| | _ <| |___
7# \___|\___/|_| \_\_____|
8#
9# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
10#
11# This software is licensed as described in the file COPYING, which
12# you should have received as part of this distribution. The terms
13# are also available at https://curl.se/docs/copyright.html.
14#
15# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16# copies of the Software, and permit persons to whom the Software is
17# furnished to do so, under the terms of the COPYING file.
18#
19# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20# KIND, either express or implied.
21#
22# SPDX-License-Identifier: curl
23#
24###########################################################################
26use strict;
27use warnings;
29# the DISABLE options that can be set by configure
30my %disable;
31# the DISABLE options that can be set by CMakeLists.txt
32my %disable_cmake;
33# the DISABLE options propagated via curl_config-cmake.h.in
34my %disable_cmake_config_h;
35# the DISABLE options that are used in C files
36my %file;
37# the DISABLE options that are documented
38my %docs;
40# we may get the directory root pointed out
41my $root = $ARGV[0] || ".";
42my $DOCS = "CURL-DISABLE.md";
44sub scanconf {
45 my ($f) = @_;
46 open(S, "<", $f);
47 while(<S>) {
48 if(/(CURL_DISABLE_[A-Z0-9_]+)/g) {
49 my ($sym) = ($1);
50 if(not $sym =~ /^(CURL_DISABLE_TYPECHECK)$/) {
51 $disable{$sym} = 1;
52 }
53 }
54 }
55 close S;
56}
58sub scan_configure {
59 opendir(my $m, "$root/m4") or die "Cannot opendir $root/m4: $!";
60 my @m4 = grep { /\.m4$/ } readdir($m);
61 closedir $m;
62 scanconf("$root/configure.ac");
63 # scan all m4 files too
64 for my $e (@m4) {
65 scanconf("$root/m4/$e");
66 }
67}
69sub scanconf_cmake {
70 my ($hashr, $f) = @_;
71 open(S, "<", $f);
72 while(<S>) {
73 if(/(CURL_DISABLE_[A-Z0-9_]+)/g) {
74 my ($sym) = ($1);
75 if(not $sym =~ /^(CURL_DISABLE_INSTALL|CURL_DISABLE_TYPECHECK)$/) {
76 $hashr->{$sym} = 1;
77 }
78 }
79 }
80 close S;
81}
83sub scan_cmake {
84 scanconf_cmake(\%disable_cmake, "$root/CMakeLists.txt");
85}
87sub scan_cmake_config_h {
88 scanconf_cmake(\%disable_cmake_config_h, "$root/lib/curl_config-cmake.h.in");
89}
91my %whitelisted = (
92 'CURL_DISABLE_DEPRECATION' => 1,
93 'CURL_DISABLE_TYPECHECK' => 1,
94);
96sub scan_file {
97 my ($source) = @_;
98 open(F, "<", $source);
99 while(<F>) {
100 while(s/(CURL_DISABLE_[A-Z0-9_]+)//) {
101 my ($sym) = ($1);
103 if(!$whitelisted{$sym}) {
104 $file{$sym} = $source;
105 }
106 }
107 }
108 close F;
109}
111sub scan_dir {
112 my ($dir) = @_;
113 opendir(my $dh, $dir) or die "Cannot opendir $dir: $!";
114 my @cfiles = grep { /\.[ch]\z/ && -f "$dir/$_" } readdir($dh);
115 closedir $dh;
116 for my $f (sort @cfiles) {
117 scan_file("$dir/$f");
118 }
119}
121sub scan_sources {
122 scan_dir("$root/include/curl");
123 scan_dir("$root/src");
124 scan_dir("$root/lib");
125 scan_dir("$root/lib/vtls");
126 scan_dir("$root/lib/vauth");
127}
129sub scan_docs {
130 open(F, "<", "$root/docs/$DOCS");
131 my $line = 0;
132 while(<F>) {
133 $line++;
134 if(/^## `(CURL_DISABLE_[A-Z0-9_]+)`/g) {
135 my ($sym) = ($1);
136 if(not $sym =~ /^(CURL_DISABLE_TYPECHECK)$/) {
137 $docs{$sym} = $line;
138 }
139 }
140 }
141 close F;
142}
144scan_configure();
145scan_cmake();
146scan_cmake_config_h();
147scan_sources();
148scan_docs();
150my $error = 0;
151# Check the configure symbols for use in code
152for my $s (sort keys %disable) {
153 if(!$file{$s}) {
154 printf "Present in configure.ac, not used by code: %s\n", $s;
155 $error++;
156 }
157 if(!$docs{$s}) {
158 printf "Present in configure.ac, not documented in $DOCS: %s\n", $s;
159 $error++;
160 }
161}
163# Check the CMakeLists.txt symbols for use in code
164for my $s (sort keys %disable_cmake) {
165 if(!$file{$s}) {
166 printf "Present in CMakeLists.txt, not used by code: %s\n", $s;
167 $error++;
168 }
169 if(!$docs{$s}) {
170 printf "Present in CMakeLists.txt, not documented in $DOCS: %s\n", $s;
171 $error++;
172 }
173}
175# Check the CMakeLists.txt symbols for use in curl_config-cmake.h.in
176for my $s (sort keys %disable_cmake) {
177 if(!$disable_cmake_config_h{$s}) {
178 printf "Present in CMakeLists.txt, not propagated via curl_config-cmake.h.in: %s\n", $s;
179 $error++;
180 }
181}
183# Check the code symbols for use in configure
184for my $s (sort keys %file) {
185 if(!$disable{$s}) {
186 printf "Not set by configure: %s (%s)\n", $s, $file{$s};
187 $error++;
188 }
189 if(!$disable_cmake{$s}) {
190 printf "Not set by CMakeLists.txt: %s (%s)\n", $s, $file{$s};
191 $error++;
192 }
193 if(!$docs{$s}) {
194 printf "Used in code, not documented in $DOCS: %s\n", $s;
195 $error++;
196 }
197}
199# Check the documented symbols
200for my $s (sort keys %docs) {
201 if(!$disable{$s}) {
202 printf "Documented but not in configure: %s\n", $s;
203 $error++;
204 }
205 if(!$disable_cmake{$s}) {
206 printf "Documented but not in CMakeLists.txt: %s\n", $s;
207 $error++;
208 }
209 if(!$file{$s}) {
210 printf "Documented, but not used by code: %s\n", $s;
211 $error++;
212 }
213}
215exit $error;
Diagnostics4 git calls · 31 ms
CallStatusSizeTime031 ms
discover200152 B3 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=3 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=3 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit3 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=25 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=3 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.7 KiB · hit25 ms
git.upload-pack fetch http.response.status_code=200 git.response.bytes=1742 git.response.cache=HIT git.response.duration_ms=25 git.fetch.wants=259e13cc8783b0a00e6bc64cff46ea62dfc25cea git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1742 git.pkt.payload.max=1721 git.sideband.band1.bytes=1720 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e2d6acad55689d
- Request
- a5c1d4f4…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format