URL: <https://savannah.gnu.org/bugs/?66071> Summary: NSUserNotification unusable when compiled with GCC Group: GNUstep Submitter: yavor Submitted: Fri 09 Aug 2024 01:30:35 PM EEST Category: Base/Foundation Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Fri 09 Aug 2024 01:30:35 PM EEST By: Yavor Doganov <yavor> [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. _______________________________________________________ File Attachments: ------------------------------------------------------- Name: gcc-synthesize.patch Size: 3KiB <https://file.savannah.gnu.org/file/gcc-synthesize.patch?file_id=56341> AGPL NOTICE These attachments are served by Savane. You can download the corresponding source code of Savane at https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-42116cd7967fbdc599220dfcf475ac6c60083cb6.tar.gz _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66071> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
Attachment:
signature.asc
Description: PGP signature