7

I'm trying to compile a C file with clang 3.6 and -Weverything but it fails at my Doxygen comment which includes the \retval tag.

My code looks like this:

/***************************************************************************/
/** Main Function.
 *
 * This function represents the main functionality.
 *
 * \retval 0 successful
 * \retval other failed
 */
int main(
    int argc,                               /**< argument count */
    char **argv                             /**< argument list */
)
{
    ...
    return 0;
}

When I try to compile it with clang I get the following warning.

$> clang-3.6 -Wall -Weverything -Werror -o main main.c
main.c:31:4: error: unknown command tag name [-Werror,-Wdocumentation-unknown-command]
 * \retval 0 successful
   ^

I know I can disable the warning by supplying -Wno-documentation-unknown-command but I think that's not the best solution.

Sven
  • 7,335
  • 4
  • 15
  • 14
  • It's the only sane solution. Either that or disable -Weverything. – Rapptz Aug 08 '14 at 06:36
  • While I'm a proponent of enabling lots of extra warnings, the `-Weverything` is quite frankly more than needed. – Some programmer dude Aug 08 '14 at 06:37
  • Or you could manually add those commands to clang... – cerkiewny Aug 08 '14 at 09:26
  • Try specifying retval manually with -fcomment-block-commands – moof2k Feb 11 '16 at 19:10
  • Unless you are traking down an actual problem `-Werror -Weverything` is usually pointless, because it literally turns on all available diagnostics - many of which are not warnings about code problems but things like this or optimization related information. – MikeMB Feb 18 '17 at 00:50

1 Answers1

4

As the comment says, you can use the option:

-fcomment-block-commands=retval

This will stop clang from complaining about the tag \retval.

Allen Supynuk
  • 144
  • 1
  • 4