Project

General

Profile

Actions

Bug #5625

closed

__GNU_UNUSED macro should have different definitions for compilers

Added by Igor Kozhukhov over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Start date:
2015-02-15
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
External Bug:

Description

current '__GNU_UNUSED' macro is using '__attribute__' for GNUC compilers and will be broken for SunStudio(for example)


Files

cch.diff (925 Bytes) cch.diff Gary Mills, 2015-03-13 01:41 PM
Actions #1

Updated by Richard PALO over 8 years ago

? sunstudio12.1 accepts both attribute((unused)) and attribute((unused))
I've been using it in some cross-compile test programs since awhile...

Perhaps it is a usage error that needs to be corrected.

What is the specific error output encountered?

You aren't trying to use a more recent studio are you? 12.3 and 12.4 seem to have gone off the deep end with respect to gcc attribute compatibility...

Actions #2

Updated by Igor Kozhukhov over 8 years ago

Richard PALO wrote:

? sunstudio12.1 accepts both attribute((unused)) and attribute((unused))
I've been using it in some cross-compile test programs since awhile...

Perhaps it is a usage error that needs to be corrected.

What is the specific error output encountered?

You aren't trying to use a more recent studio are you? 12.3 and 12.4 seem to have gone off the deep end with respect to gcc attribute compatibility...

i saw point to it by Gary Mils and i think, it is possible breakage for some others cross compilers.
will better fix it for compatibility.

Actions #3

Updated by Gary Mills over 8 years ago

This is the error I got:


/opt/solstudio12.2/bin/cc -xchip=ultra -Wc,-xcode=abs32
-Wc,-Qiselect-regsym=0 -m64 -xO3 ../../sparc/ml/sparc.il
-D_ASM_INLINES -Xa -xspace -W0,-Lt -errtags=yes -errwarn=%all -g
-Wc,-Qiselect-T1 -xc99=%all -W0,-noglobal -xdebugformat=stabs
-xc99=%all -Wd,-xsafe=unboundsym -Wc,-Qassembler-ounrefsym=0
-W2,-xwrap_int -W0,-xglobalstatic -xregs=no%float -xstrconst -v
-D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL -D_ELF64 -D_DDI_STRICT -Dsun
-D__sun -D__SVR4 -DSPITFIRE_MINREV_SUPPORTED=0x21 -DSF_ERRATA_30
-DBB_ERRATA_1 -DSF_ERRATA_32 -DSF_ERRATA_51 -DSF_ERRATA_54
-DSF_ERRATA_57 -DSF_V9_TABLE_28 -DCHEETAH_MINREV_SUPPORTED=0x30
-DCHEETAHPLUS_ERRATUM_25 -DCHEETAH_ERRATUM_109 -DCHEETAH_ERRATUM_127
-DJALAPENO_ERRATA_85 -DCHEETAHPLUS_ERRATUM_34 -I../../sparc
-I../../sparc/krtld -I../../sparc/v9 -I../../sun -I../../sun4 -Y
I,../../common
-I/dpool/export/home/mills/Downloads/code/illumos-gate/usr/src/common
-I/dpool/export/home/mills/Downloads/code/illumos-gate/usr/src/uts/common/fs/zfs-c -o /tmp/nightly.tmpdir.6143/.cwCAA3XaWH6.o -I../../../common/bzip2
../../../common/bzip2/compress.c
"../../../common/bzip2/compress.c", line 244: attribute "__unused__" is unknown, ignored (E_ATTRIBUTE_UNKNOWN)
cc: acomp failed for ../../../common/bzip2/compress.c

This is the source for common/bzip2/compress.c:


239 static
240 void sendMTFValues ( EState* s )
241 {
242 Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
243 Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
-------------------------------------------------------------------------------
244 Int32 nGroups, __GNU_UNUSED nBytes;
-------------------------------------------------------------------------------
245

The bug number is 5456 .

Actions #4

Updated by Richard PALO over 8 years ago

I copy my observation from 5456 here:

I tried building this snippet with studio 12.1 and it success without warning, so this seems related to the fact
that a more recent release such as 12.[234] was used...

Actions #6

Updated by Gary Mills about 8 years ago

I'd also recommend maintaining the ``__sun_attr__((unused))'' style in sys/ccompile.h . Unless you want to change all of them, you should follow the suggestion by Andy Stormont.

Actions #7

Updated by Gary Mills about 8 years ago

Here are the errors I got when building in usr/src/lib/libmvec/sparcv9 with the Studio compiler:

"../common/__vcos.c", line 105:  attribute "__unused__" is unknown, ignored (E_ATTRIBUTE_UNKNOWN)
cc: acomp failed for ../common/__vcos.c
"../common/__vsin.c", line 85:  attribute "__unused__" is unknown, ignored (E_ATTRIBUTE_UNKNOWN)
cc: acomp failed for ../common/__vsin.c

I fixed it with an addition to usr/src/uts/common/sys/ccompile.h, according to the attached file cch.diff .

Actions #8

Updated by Igor Kozhukhov about 8 years ago

  • Status changed from In Progress to Pending RTI
  • % Done changed from 80 to 90
Actions #9

Updated by Electric Monk about 8 years ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 90 to 100

git commit 05c2421435747d58bdc8212e3253bdd321948b8a

commit  05c2421435747d58bdc8212e3253bdd321948b8a
Author: Igor Kozhukhov <ikozhukhov@gmail.com>
Date:   2015-04-03T13:48:11.000Z

    5625 __GNU_UNUSED macro should have different definitions for compilers
    Reviewed by: Andy Stormont <astormont@racktopsystems.com>
    Reviewed by: Gary Mills <gary_mills@fastmail.fm>
    Approved by: Gordon Ross <gwr@nexenta.com>

Actions

Also available in: Atom PDF