Skip to content

Maintenance: cleanup the libsecurity API#2406

Open
yadij wants to merge 1 commit intosquid-cache:masterfrom
yadij:cleanup-security-forward
Open

Maintenance: cleanup the libsecurity API#2406
yadij wants to merge 1 commit intosquid-cache:masterfrom
yadij:cleanup-security-forward

Conversation

@yadij
Copy link
Copy Markdown
Contributor

@yadij yadij commented Apr 11, 2026

Replace some typedef with using keyword to cleanup the
readability of grep output.

Add C++17 [[maybe_unused]] attribute to remove need for (void)
casting when no security library is is linked against. For
cleaner code with warnings only when they actually matter.

No logic changes.

Replace some typedef with using keyword to cleanup
the readability of grep output.

Add C++17 [[maybe_unused]] attribute to remove
need for (void) casting when no security library is
is linked against. For cleaner code with warnings
only when they actually matter.

No logic changes.
Copy link
Copy Markdown
Contributor

@rousskov rousskov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR breaks CI build and likely to cause many conflicts with backlogged changes. A couple of other concerns are detailed in charge requests. I plan to come back to this after the backlog is dealt with.


static bool
CreateSession(const Security::ContextPointer &ctx, const Comm::ConnectionPointer &conn, Security::PeerOptions &opts, Security::Io::Type type, const char *squidCtx)
CreateSession(const Security::ContextPointer &ctx, const Comm::ConnectionPointer &conn, Security::PeerOptions &opts, [[maybe_unused]] Security::Io::Type type, [[maybe_unused]] const char *squidCtx)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, code that should use, say, squidCtx but forgets to do so is no longer going to be flagged by the compiler. The improved esthetics are not worth losing those checks in those cases IMHO. The same concern probably applies to some other changes in this PR.

debugs(83, DBG_IMPORTANT, "ERROR: " << squidCtx << ' ' << errAction <<
": " << (errCode != 0 ? Security::ErrorString(errCode) : ""));
#else
(void)ctx;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx was not marked as "maybe unused", so its line should not be deleted from here AFAICT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants