Project

General

Profile

Bug #5625

__GNU_UNUSED macro should have different definitions for compilers

Added by Igor Kozhukhov almost 6 years ago. Updated over 5 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:

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
#1

Updated by Richard PALO almost 6 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...

#2

Updated by Igor Kozhukhov almost 6 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.

#3

Updated by Gary Mills almost 6 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 .

#4

Updated by Richard PALO almost 6 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...

#6

Updated by Gary Mills almost 6 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.

#7

Updated by Gary Mills over 5 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 .

#8

Updated by Igor Kozhukhov over 5 years ago

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

Updated by Electric Monk over 5 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>

Also available in: Atom PDF