autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] specify void prototype for functions with no parameters


From: Zack Weinberg
Subject: Re: [PATCH] specify void prototype for functions with no parameters
Date: Thu, 18 Aug 2022 14:20:29 -0400
User-agent: Cyrus-JMAP/3.7.0-alpha0-841-g7899e99a45-fm-20220811.002-g7899e99a

On Wed, Aug 17, 2022, at 12:51 PM, Khem Raj wrote:
> Compilers defaulting to C99 flag such functions as warning which fails
> to compile when using -Werror

Let's keep the discussion of whether we should make this change at all
to the other thread, but also I have some line-by-line feedback for you...

> @@ -258,7 +258,7 @@ dnl other built-in extern "C" functions, but let's
> worry about that
>  dnl when it actually happens.
>  [AC_LANG_PROGRAM([[$1
>  namespace conftest {
> -  extern "C" int $2 ();
> +  extern "C" int $2 (void);
>  }]],
>  [[return conftest::$2 ();]])])
>
> @@ -2474,7 +2474,7 @@ using std::strcmp;
>
>  namespace {
>
> -void test_exception_syntax()
> +void test_exception_syntax(void)
>  {
>    try {
>      throw "test";

These two patch chunks are only ever compiled as C++, so it should not
be necessary to change them.  It shouldn't do any _harm_, but my
understanding is that preferred style in C++ is to use () rather than
(void) for functions that take no arguments, so we should probably
stick to that.

zw



reply via email to

[Prev in Thread] Current Thread [Next in Thread]