bugGNUstep - Bugs: bug #66071, NSUserNotification unusable when...

Group
 
 

bug #66071: NSUserNotification unusable when compiled with GCC

Submitter:  Yavor Doganov <yavor>
Submitted:  Fri 09 Aug 2024 10:30:35 AM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 09 Aug 2024 10:30:35 AM UTC, original submission:  

[Sorry for submitting at Savannah but I have no way to use the bug reporting facility you have chosen.]

Base 1.30.0, GCC 14.2.0, GNU/Linux amd64 (x86_64)

A test program using NSUserNotification/NSUserNotificationCenter compiles fine but fails at link time due to missing symbols (and indeed, objdump confirms that __objc_class_name_NSUserNotification and __objc_class_name_NSUserNotificationCenter are not in the symbols table).

It looks like GCC requires the ivars to be declared in addition to the @property declarations and it also requires explicit @synthesize to actually do the job of generating the setters/getters definitions.  The former is somewhat logical since GCC does not support nonfragile ivars.

GCC 14 started diagnosing this:

gcc NSUserNotification.m -c \
      -MMD -MP -Wdate-time -D_FORTIFY_SOURCE=2 -DGNUSTEP_TARGET_DIR=\".\" -DGNUSTEP_TARGET_CPU=\"x86_64\" -DGNUSTEP_TARGET_OS=\"linux-gnu\" -DGNUSTEP_IS_FLATTENED=\"yes\" -DLIBRARY_COMBO=\"gnu-gnu-gnu\" -DGNUSTEP_BASE_INTERNAL=1 -Wall -Wdeclaration-after-statement -Wcast-align -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -fconstant-string-class=NSConstantString -I../Headers -I./. -I. -I/usr/local/include/GNUstep -I/usr/include/GNUstep -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/local/include/GNUstep -I/usr/local/include/GNUstep -I/usr/include/GNUstep -I/usr/include/libxml2 -I/usr/include/libxml2 -I/usr/include/p11-kit-1 \
       -o obj/libgnustep-base.obj/NSUserNotification.m.o
NSUserNotification.m:42:31: warning: object property ‘actualDeliveryDate’ has no ‘assign’, ‘retain’ or ‘copy’ attribute; assuming ‘assign’
   42 | @property (readwrite) NSDate *actualDeliveryDate;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
NSUserNotification.m:42:31: note: ‘assign’ can be unsafe for Objective-C objects; please state explicitly if you need it
NSUserNotification.m:46:43: warning: object property ‘response’ has no ‘assign’, ‘retain’ or ‘copy’ attribute; assuming ‘assign’
   46 | @property (readwrite) NSAttributedString *response;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
NSUserNotification.m:46:43: note: ‘assign’ can be unsafe for Objective-C objects; please state explicitly if you need it
NSUserNotification.m:89:1: warning: incomplete implementation of class ‘NSUserNotification’
   89 | @end
      | ^
NSUserNotification.m:89:1: warning: method definition for ‘-setActualDeliveryDate:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setPresented:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setRemote:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setActivationType:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setResponse:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setTitle:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-title’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setSubtitle:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-subtitle’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setInformativeText:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-informativeText’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setActionButtonTitle:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-actionButtonTitle’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setUserInfo:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-userInfo’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setDeliveryDate:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-deliveryDate’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setDeliveryTimeZone:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-deliveryTimeZone’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setDeliveryRepeatInterval:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-deliveryRepeatInterval’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-actualDeliveryDate’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-isPresented’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-isRemote’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setSoundName:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-soundName’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setHasActionButton:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-hasActionButton’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-activationType’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setOtherButtonTitle:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-otherButtonTitle’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setIdentifier:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-identifier’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setContentImage:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-contentImage’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setHasReplyButton:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-hasReplyButton’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-setResponsePlaceholder:’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-responsePlaceholder’ not found
NSUserNotification.m:89:1: warning: method definition for ‘-response’ not found
NSUserNotification.m:92:32: warning: object property ‘deliveredNotifications’ has no ‘assign’, ‘retain’ or ‘copy’ attribute; assuming ‘assign’
   92 | @property (readwrite) NSArray *deliveredNotifications;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
NSUserNotification.m:92:32: note: ‘assign’ can be unsafe for Objective-C objects; please state explicitly if you need it
NSUserNotification.m:286:1: warning: incomplete implementation of class ‘NSUserNotificationCenter’
  286 | @end
      | ^
NSUserNotification.m:286:1: warning: method definition for ‘-setDeliveredNotifications:’ not found
NSUserNotification.m:286:1: warning: method definition for ‘-setDelegate:’ not found
NSUserNotification.m:286:1: warning: method definition for ‘-delegate’ not found
NSUserNotification.m:286:1: warning: method definition for ‘-setScheduledNotifications:’ not found
NSUserNotification.m:286:1: warning: method definition for ‘-scheduledNotifications’ not found
NSUserNotification.m:286:1: warning: method definition for ‘-deliveredNotifications’ not found


The attached patch works for me (my test program links and works as intended) but I am not sure it is correct.

Yavor Doganov <yavor>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #56341:  gcc-synthesize.patch added by yavor (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by yavor (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-08-09 yavor Attached File- Added gcc-synthesize.patch, #56341

    Back to the top

    Powered by Savane 3.14-7003.
    Corresponding source code