Skip to content

mod.ccontrol: does not compile with LOGTOHD undefined (misplaced brace in glineChannelUsers) #95

Description

@MrIron-no

mod.ccontrol/ccontrol.h:26 is #define LOGTOHD, with the comment "Undef this if you want to log to the database" — so both positions of the switch are meant to build. With LOGTOHD undefined, mod.ccontrol does not compile.

In ccontrol::glineChannelUsers(), mod.ccontrol/ccontrol.cc:4949-4971:

  • 4949 opens if (showCGIpsInLogs && ...)
  • 4951 opens for (list<string>::iterator sItr = ipList.begin(); ...)
  • 4953 #ifndef LOGTOHD, 4958 #else, 4970 #endif
  • the for loop's closing brace is at 4969, inside the #else arm, and a second brace follows at 4971

With LOGTOHD defined the #else arm is compiled and the braces balance: 4969 closes the for, 4971 closes the if. With LOGTOHD undefined the #else arm is stripped along with the brace at 4969, so only 4971 remains — it closes the for, and both the if and the function body are left open. Compilation then fails with roughly two dozen errors, the first being

error: qualified-id in declaration before '(' token

at the next definition.

This is visible without compiling anything: because the braces read as unbalanced, subsequent file-scope definitions are indented as if nested — mod.ccontrol/ccontrol.cc:4976 reads void ccontrol::isNowAnOper(iClient * theUser) { with four leading spaces at file scope, and return success; at 4973 is indented eight.

Fix: move the closing brace out of the #else arm to after #endif, and drop the duplicate.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions