Project

General

Profile

Bug #5910

libnisdb won't build with modern GCC

Added by Andrew Stormont almost 6 years ago. Updated over 5 years ago.

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

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

libnisdb is suffering from the following issues which cause problems with newer versions of GCC:

- in nis_parse_ldap_mapc.c s_malloc is missing a prototype
- in db_mindex3.cc entriesFromLDAP tries to cast void pointer to int
- in db_mindex3.cc entriesFromLDAPthread tries to cast int to void pointer
- in db_table.cc __setMaxTimeT tries to shift past int width
- in nis_db.cc db_in_dict_file tries to cast pointer to bool_t


Files

libnisdb.diff (3.22 KB) libnisdb.diff Andrew Stormont, 2015-05-05 11:31 AM

Related issues

Related to illumos gate - Bug #3062: illumos should build/work with GCC 4.6 or newerResolvedToomas Soome2012-08-07

Actions
#1

Updated by Andrew Stormont almost 6 years ago

  • Related to Bug #3062: illumos should build/work with GCC 4.6 or newer added
#2

Updated by Gary Mills almost 6 years ago

That line:

+ return (NULL);

at the end of your change to usr/src/lib/libnisdb/db_mindex3.cc can't be right. NULL is a pointer. The function is supposed to return an integer. The rest of the patch looks fine to me.

#3

Updated by Andrew Stormont almost 6 years ago

The functions returns a void pointer. NULL shuts the compiler up but I'm not sure if it really is the right thing to return. It looks to me like the return value isn't used anywhere so it should be okay, but I don't understand the code that well.

#4

Updated by Gary Mills almost 6 years ago

Oops, I was looking at the wrong function. entriesFromLDAPthread() does indeed return a void pointer. The original code does cast an int into a void pointer, which is clearly wrong. NULL is okay in this context.

#5

Updated by Gary Mills over 5 years ago

I just noticed that `CFLAGS += $(CCVERBOSE)' is missing from the Makefile . I'll try adding that to see what develops.

#6

Updated by Gary Mills over 5 years ago

What developed was dozens of missing prototype errors like this one:

"db_entry_c_xdr.c", line 48: warning: implicitly declaring function to return int: xdr_entry_obj() (E_IMPLICIT_DECL_FUNC_RETURN_INT)

I'm using gcc 4.4.4 as the primary compiler and Sun Studio as the shadow compiler. Once I supplied all the missing prototypes through header files, the errors disappeared. The generated object files were identical. My next step is to see how many of the `-_gcc=-Wno-' lines I can safely remove from the Makefile.

#7

Updated by Electric Monk over 5 years ago

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

git commit a87701e9837f8a9ee9e4c4d3186295c0e29f743f

commit  a87701e9837f8a9ee9e4c4d3186295c0e29f743f
Author: Gary Mills <gary_mills@fastmail.fm>
Date:   2015-08-07T02:16:40.000Z

    5910 libnisdb won't build with modern GCC
    Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
    Reviewed by: "Toomas Soome" <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF