Project

General

Profile

Bug #7645

illumos-gate lint build fails with glib 2.46.2

Added by Alexander Pyhalov over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-12-05
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

Glib 2.46.2 has the following code in /usr/include/glib-2.0/glib/glib-autocleanups.h:

 31 static inline void
 32 g_autoptr_cleanup_gstring_free (GString *string)
 33 {
 34   if (string)
 35     g_string_free (string, TRUE);
 36 }
 37 

This disappoints lint:
"/usr/include/glib-2.0/glib/glib-autocleanups.h", line 35: warning: function returns value which is sometimes ignored: g_string_free (E_FUNC_RET_MAYBE_IGNORED2)

History

#1

Updated by Alexander Pyhalov over 2 years ago

Fix:

diff --git a/usr/src/cmd/latencytop/Makefile.com b/usr/src/cmd/latencytop/Makefile.com
index 4b97407..a804857 100644
--- a/usr/src/cmd/latencytop/Makefile.com
+++ b/usr/src/cmd/latencytop/Makefile.com
@@ -42,8 +42,10 @@ all install  := LDLIBS += -lglib-2.0

 LINTFLAGS += -erroff=E_NAME_USED_NOT_DEF2
 LINTFLAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2
+LINTFLAGS += -erroff=E_FUNC_RET_MAYBE_IGNORED2
 LINTFLAGS64 += -erroff=E_NAME_USED_NOT_DEF2
 LINTFLAGS64 += -erroff=E_FUNC_RET_ALWAYS_IGNOR2
+LINTFLAGS64 += -erroff=E_FUNC_RET_MAYBE_IGNORED2

 FILEMODE = 0555

#2

Updated by Toomas Soome over 2 years ago

Alexander Pyhalov wrote:

Fix:
[...]

in fact the value from g_string_free() is always ignored, so the (void)g_string_free() would be more correct there.

#3

Updated by Electric Monk over 2 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit 0570e35bbcf3793c3e5aef6ae971d1b6a32bacff

commit  0570e35bbcf3793c3e5aef6ae971d1b6a32bacff
Author: Alexander Pyhalov <apyhalov@gmail.com>
Date:   2016-12-07T23:22:14.000Z

    7645 illumos-gate lint build fails with glib 2.46.2
    Reviewed by: Adam Števko <adam.stevko@gmail.com>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

Also available in: Atom PDF