Skip to content

Commit fcd2c77

Browse files
committed
Require ATS plugins to be compiled with C++17.
Renames all plugin and example files with .c extension to have .cc extensions. Fix resulting errors.
1 parent 47572a4 commit fcd2c77

File tree

128 files changed

+1684
-1883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1684
-1883
lines changed

example/plugins/c-api/Makefile.am

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,45 +68,45 @@ pkglib_LTLIBRARIES = $(example_Plugins)
6868

6969
endif
7070

71-
add_header_la_SOURCES = add_header/add_header.c
72-
append_transform_la_SOURCES = append_transform/append_transform.c
73-
basic_auth_la_SOURCES = basic_auth/basic_auth.c
74-
denylist_0_la_SOURCES = denylist_0/denylist_0.c
75-
denylist_1_la_SOURCES = denylist_1/denylist_1.c
76-
bnull_transform_la_SOURCES = bnull_transform/bnull_transform.c
71+
add_header_la_SOURCES = add_header/add_header.cc
72+
append_transform_la_SOURCES = append_transform/append_transform.cc
73+
basic_auth_la_SOURCES = basic_auth/basic_auth.cc
74+
denylist_0_la_SOURCES = denylist_0/denylist_0.cc
75+
denylist_1_la_SOURCES = denylist_1/denylist_1.cc
76+
bnull_transform_la_SOURCES = bnull_transform/bnull_transform.cc
7777
cert_update_la_SOURCES = cert_update/cert_update.cc
78-
request_buffer_la_SOURCES = request_buffer/request_buffer.c
78+
request_buffer_la_SOURCES = request_buffer/request_buffer.cc
7979
cache_scan_la_SOURCES = cache_scan/cache_scan.cc
8080
client_context_dump_la_SOURCES = client_context_dump/client_context_dump.cc
81-
file_1_la_SOURCES = file_1/file_1.c
82-
hello_la_SOURCES = hello/hello.c
81+
file_1_la_SOURCES = file_1/file_1.cc
82+
hello_la_SOURCES = hello/hello.cc
8383
intercept_la_SOURCES = intercept/intercept.cc
84-
lifecycle_plugin_la_SOURCES = lifecycle_plugin/lifecycle_plugin.c
85-
null_transform_la_SOURCES = null_transform/null_transform.c
86-
output_header_la_SOURCES = output_header/output_header.c
84+
lifecycle_plugin_la_SOURCES = lifecycle_plugin/lifecycle_plugin.cc
85+
null_transform_la_SOURCES = null_transform/null_transform.cc
86+
output_header_la_SOURCES = output_header/output_header.cc
8787
passthru_la_SOURCES = passthru/passthru.cc
88-
protocol_la_SOURCES = protocol/Protocol.c protocol/TxnSM.c
88+
protocol_la_SOURCES = protocol/Protocol.cc protocol/TxnSM.cc
8989
protocol_stack_la_SOURCES = protocol_stack/protocol_stack.cc
90-
psi_la_SOURCES = thread_pool/psi.c thread_pool/thread.c
91-
query_remap_la_SOURCES = query_remap/query_remap.c
90+
psi_la_SOURCES = thread_pool/psi.cc thread_pool/thread.cc
91+
query_remap_la_SOURCES = query_remap/query_remap.cc
9292
remap_header_add_la_SOURCES = remap_header_add/remap_header_add.cc
9393
remap_la_SOURCES = remap/remap.cc
94-
replace_header_la_SOURCES = replace_header/replace_header.c
95-
response_header_1_la_SOURCES = response_header_1/response_header_1.c
96-
secure_link_la_SOURCES = secure_link/secure_link.c
97-
server_push_la_SOURCES = server_push/server_push.c
98-
server_transform_la_SOURCES = server_transform/server_transform.c
94+
replace_header_la_SOURCES = replace_header/replace_header.cc
95+
response_header_1_la_SOURCES = response_header_1/response_header_1.cc
96+
secure_link_la_SOURCES = secure_link/secure_link.cc
97+
server_push_la_SOURCES = server_push/server_push.cc
98+
server_transform_la_SOURCES = server_transform/server_transform.cc
9999
ssl_preaccept_la_SOURCES = ssl_preaccept/ssl_preaccept.cc
100100
ssl_sni_la_SOURCES = ssl_sni/ssl_sni.cc
101101
ssl_sni_allowlist_la_SOURCES = ssl_sni_allowlist/ssl_sni_allowlist.cc
102102
disable_http2_la_SOURCES = disable_http2/disable_http2.cc
103103
verify_cert_la_SOURCES = verify_cert/verify_cert.cc
104104
statistic_la_SOURCES = statistic/statistic.cc
105-
thread_1_la_SOURCES = thread_1/thread_1.c
105+
thread_1_la_SOURCES = thread_1/thread_1.cc
106106
txn_data_sink_la_SOURCES = txn_data_sink/txn_data_sink.cc
107-
version_la_SOURCES = version/version.c
108-
redirect_1_la_SOURCES = redirect_1/redirect_1.c
109-
session_hooks_la_SOURCES = session_hooks/session_hooks.c
107+
version_la_SOURCES = version/version.cc
108+
redirect_1_la_SOURCES = redirect_1/redirect_1.cc
109+
session_hooks_la_SOURCES = session_hooks/session_hooks.cc
110110
vconn_args_la_SOURCES = vconn_args/vconn_args.cc
111111

112112
clang-tidy-local: $(DIST_SOURCES)
File renamed without changes.

example/plugins/c-api/append_transform/append_transform.c renamed to example/plugins/c-api/append_transform/append_transform.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ handle_transform(TSCont contp)
106106
structure contains the output VIO and output buffer. If the
107107
private data structure pointer is NULL, then we'll create it
108108
and initialize its internals. */
109-
data = TSContDataGet(contp);
109+
data = static_cast<decltype(data)>(TSContDataGet(contp));
110110
if (!data) {
111111
towrite = TSVIONBytesGet(write_vio);
112112
if (towrite != INT64_MAX) {
@@ -204,7 +204,7 @@ append_transform(TSCont contp, TSEvent event, void *edata ATS_UNUSED)
204204
/* Check to see if the transformation has been closed by a call to
205205
TSVConnClose. */
206206
if (TSVConnClosedGet(contp)) {
207-
my_data_destroy(TSContDataGet(contp));
207+
my_data_destroy(static_cast<MyData *>(TSContDataGet(contp)));
208208
TSContDestroy(contp);
209209
return 0;
210210
} else {
File renamed without changes.

example/plugins/c-api/bnull_transform/bnull_transform.c renamed to example/plugins/c-api/bnull_transform/bnull_transform.cc

File renamed without changes.

example/plugins/c-api/denylist_0/denylist_0.c renamed to example/plugins/c-api/denylist_0/denylist_0.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ handle_response(TSHttpTxn txnp)
115115
goto done;
116116
}
117117

118-
buf = TSmalloc(4096);
118+
buf = tsapi::malloc<char>(4096);
119119

120120
url_str = TSUrlStringGet(bufp, url_loc, &url_length);
121121
snprintf(buf, 4096, "You are forbidden from accessing \"%s\"\n", url_str);

example/plugins/c-api/denylist_1/denylist_1.c renamed to example/plugins/c-api/denylist_1/denylist_1.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ static TSCont global_contp;
4040

4141
static void handle_txn_start(TSCont contp, TSHttpTxn txnp);
4242

43+
enum calling_func {
44+
HANDLE_DNS,
45+
HANDLE_RESPONSE,
46+
READ_BLOCKLIST,
47+
};
48+
4349
typedef struct contp_data {
44-
enum calling_func {
45-
HANDLE_DNS,
46-
HANDLE_RESPONSE,
47-
READ_BLOCKLIST,
48-
} cf;
50+
calling_func cf;
4951

5052
TSHttpTxn txnp;
5153

example/plugins/c-api/lifecycle_plugin/lifecycle_plugin.c renamed to example/plugins/c-api/lifecycle_plugin/lifecycle_plugin.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
#define PLUGIN_NAME "lifecycle"
3434

3535
int
36-
CallbackHandler(TSCont this, TSEvent id, void *data)
36+
CallbackHandler(TSCont, TSEvent id, void *data)
3737
{
38-
(void)this; // make compiler shut up about unused variable.
3938
switch (id) {
4039
case TS_EVENT_LIFECYCLE_PORTS_INITIALIZED:
4140
TSDebug(PLUGIN_NAME, "Proxy ports initialized");

0 commit comments

Comments
 (0)