public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rfm at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug objc/94637] New: @selector() broken for selectors containing repeated colons
Date: Fri, 17 Apr 2020 12:50:17 +0000	[thread overview]
Message-ID: <bug-94637-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94637

            Bug ID: 94637
           Summary: @selector() broken for selectors containing repeated
                    colons
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rfm at gnu dot org
  Target Milestone: ---

The compiler fails to compile legal Objective-C programs which use the
@selector() syntax to send message to objects, if those messages have multiple
parameters and the method does not describe each one.

eg. when given @selector(styleoffsets::::::) the compiler errors with the
message
 error: expected ‘)’ before ‘::’ token

Within @selector() each colon marks the position at which an argument would be
inserted in a method invocation (when a message is sent to an object).  It is
therefore not legal for the compiler to consider a pair of colons to be a token
in this context.

In the above example, the method declaration looks like this:

- (void) styleoffsets: (float*)l : (float*)r : (float*)t : (float*)b
                     : (unsigned int)style;

While imo it would be better coding style to describe parameters as part of the
method name, it's certainly correct/legal objective-c to have multiple
parameters each preceded only by a colon.

A trivial program to demonstrate the bug would be

#include <stdio.h>
#include <objc/objc.h>

int main()
{
  SEL   s = @selector(example::);
  printf("%s\n", sel_getName(s));
  return 0;
}


This program, if built with the command 'gcc program.m -lobjc' should produce
an a.out which just prints the selector name.

             reply	other threads:[~2020-04-17 12:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 12:50 rfm at gnu dot org [this message]
2020-04-17 12:52 ` [Bug objc/94637] " rfm at gnu dot org
2020-04-17 14:17 ` egallager at gcc dot gnu.org
2020-04-17 16:35 ` [Bug objc/94637] [10 Regression] " pinskia at gcc dot gnu.org
2020-04-17 16:36 ` pinskia at gcc dot gnu.org
2020-04-17 17:48 ` law at redhat dot com
2020-04-17 18:01 ` jakub at gcc dot gnu.org
2020-04-19 10:14 ` cvs-commit at gcc dot gnu.org
2020-04-19 21:36 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94637-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).