Project

General

Profile

Actions

Bug #580

closed

'const const char' declarations break build with recent GCC

Added by Adam Williamson over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
High
Target version:
Start date:
2017-07-25
Due date:
% Done:

100%

Estimated time:
Patch Available:
Yes
Found in Versions:
Confirmed:
Yes
Branch:
Security:
No
Help Needed:
No

Description

Current bip fails to build with recent GCC versions and default compiler flags:

src/log.c:442:37: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
 void log_part(log_t *logdata, const const char *ircmask, const char *channel,
                                     ^~~~~
src/log.c:443:9: error: duplicate 'const' declaration specifier [-Werror=duplicate-decl-specifier]
   const const char *message)
         ^~~~~
cc1: all warnings being treated as errors

Indeed there are two const const char declarations in src/log.c log_part function. I'm attaching a patch that fixes these.

Actions #1

Updated by Adam Williamson over 6 years ago

Having trouble attaching a file, so here's the patch in-line, it's pretty trivial:

From 7e2d06a1d06f22f807ffcdac2b132b1f08e21f95 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 25 Jul 2017 13:08:38 -0700
Subject: [PATCH] Fix some 'const const char' declarations

That's one two many consts...recent GCC blips on this.
---
 src/log.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/log.c b/src/log.c
index 26fa24d..457337a 100644
--- a/src/log.c
+++ b/src/log.c
@@ -440,8 +440,8 @@ void log_join(log_t *logdata, const char *ircmask, const char *channel)
        log_write(logdata, channel, logdata->buffer);
 }

-void log_part(log_t *logdata, const const char *ircmask, const char *channel,
-               const const char *message)
+void log_part(log_t *logdata, const char *ircmask, const char *channel,
+               const char *message)
 {
        if (message)
                snprintf(logdata->buffer, LOGLINE_MAXLEN,
-- 
2.13.3

Actions #2

Updated by Pierre-Louis Bonicoli over 6 years ago

  • Description updated (diff)
Actions #3

Updated by Pierre-Louis Bonicoli over 6 years ago

  • Status changed from New to Resolved
  • Assignee set to Pierre-Louis Bonicoli
  • Target version set to 0.9.0
  • % Done changed from 0 to 100
  • Confirmed changed from No to Yes
  • Security set to No
  • Help Needed set to No

I was able to reproduce using gcc 7.1.0.

Patch committed (2ecd82f0112e6d57e8651296d624975aa56e03a4), many thanks !

Actions

Also available in: Atom PDF