llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Can not use C99 function names as variable names in C89

Open llvmbot opened this issue 13 years ago • 11 comments

Bugzilla Link 15150
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @gribozavr

Extended Description

The following code doesn't compile in clang, but does in gcc:

int logf = 5;
int main() {
        return logf;
}
# gcc test.c -o test -std=c89
# ./test; echo $?
5
# clang test.c -o test -std=c89
test.c:1:5: error: redefinition of 'logf' as different kind of symbol
int logf = 5;
    ^
test.c:1:5: note: previous definition is here
test.c:4:16: warning: incompatible pointer to integer conversion returning 'float (float)' from a function with result type 'int' [-Wint-conversion]
        return logf;
               ^~~~
1 warning and 1 error generated.

llvmbot avatar Feb 04 '13 12:02 llvmbot

@llvm/issue-subscribers-c

llvmbot avatar Jun 08 '23 19:06 llvmbot

@llvm/issue-subscribers-clang-frontend

llvmbot avatar Jun 08 '23 19:06 llvmbot

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor has already been assigned to this issue. If you believe that no one is actually working on it despite an assignment, ping the person. After one week without a response, the assignee may be changed.
  2. In the comments of this issue, request for it to be assigned to you, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

llvmbot avatar Nov 19 '24 18:11 llvmbot

@llvm/issue-subscribers-good-first-issue

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [15150](https://llvm.org/bz15150) | | Version | unspecified | | OS | All | | Reporter | LLVM Bugzilla Contributor | | CC | @gribozavr |

Extended Description

The following code doesn't compile in clang, but does in gcc:

int logf = 5; int main() { return logf; }

gcc test.c -o test -std=c89

./test; echo $?

5

clang test.c -o test -std=c89

test.c:1:5: error: redefinition of 'logf' as different kind of symbol int logf = 5; ^ test.c:1:5: note: previous definition is here test.c:4:16: warning: incompatible pointer to integer conversion returning 'float (float)' from a function with result type 'int' [-Wint-conversion] return logf; ^~~~ 1 warning and 1 error generated.

llvmbot avatar Nov 19 '24 18:11 llvmbot

I am working on this

tlemy avatar Dec 07 '24 13:12 tlemy

@tlemy are you still working on this one?

vinay-deshmukh avatar Mar 01 '25 04:03 vinay-deshmukh

@vinay-deshmukh no

tlemy avatar Mar 01 '25 05:03 tlemy

Thanks, I'll take this up then!

vinay-deshmukh avatar Mar 05 '25 01:03 vinay-deshmukh

Hey, @vinay-deshmukh are you still working on this? If not, I would like to take this up.

RoshanYSingh23 avatar Feb 07 '26 19:02 RoshanYSingh23

Hey, @vinay-deshmukh are you still working on this? If not, I would like to take this up.

Go for it!

vinay-deshmukh avatar Feb 09 '26 13:02 vinay-deshmukh

@RoshanYSingh23 Please note, we don't assign issues until there is a PR and we check and make sure it is headed in the right direction.

shafik avatar Feb 09 '26 16:02 shafik