Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entry point identifiers with single quote break C compilation #1841

Closed
nbos opened this issue Jan 17, 2023 · 2 comments
Closed

Entry point identifiers with single quote break C compilation #1841

nbos opened this issue Jan 17, 2023 · 2 comments

Comments

@nbos
Copy link
Contributor

nbos commented Jan 17, 2023

Compiling for instance

entry f (x: f32) : f32 = x
entry f' (x: f32) : f32 = x+1

with a C generating backend like multicore raises

cc failed with code 1:
test.c:1989:30: warning: missing terminating ' character
 1989 | static int futrts_cli_entry_f'(struct futhark_context *ctx)
      |                              ^
test.c:1989:30: error: missing terminating ' character
 1989 | static int futrts_cli_entry_f'(struct futhark_context *ctx)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.c:1990:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 1990 | {
      | ^
test.c: In function ‘main’:
test.c:2122:126: warning: missing terminating ' character
 2122 |     struct entry_point_entry entry_points[] = {{.name ="f", .fun =futrts_cli_entry_f}, {.name ="f'", .fun =futrts_cli_entry_f'}};
      |                                                                                                                              ^
test.c:2122:126: error: missing terminating ' character
 2122 |     struct entry_point_entry entry_points[] = {{.name ="f", .fun =futrts_cli_entry_f}, {.name ="f'", .fun =futrts_cli_entry_f'}};
      |                                                                                                                              ^~~~
test.c:2124:5: error: expected ‘}’ before ‘if’
 2124 |     if (entry_point != NULL) {
      |     ^~
test.c:2122:88: note: to match this ‘{’
 2122 |     struct entry_point_entry entry_points[] = {{.name ="f", .fun =futrts_cli_entry_f}, {.name ="f'", .fun =futrts_cli_entry_f'}};
      |                                                                                        ^
In file included from test.c:2165:
/usr/include/assert.h:67:1: error: expected ‘}’ before ‘extern’
   67 | extern void __assert_fail (const char *__assertion, const char *__file,
      | ^~~~~~
test.c:2122:47: note: to match this ‘{’
 2122 |     struct entry_point_entry entry_points[] = {{.name ="f", .fun =futrts_cli_entry_f}, {.name ="f'", .fun =futrts_cli_entry_f'}};
      |                                               ^
test.c:7748:1: error: expected declaration or statement at end of input
 7748 | }
      | ^
@athas
Copy link
Member

athas commented Jan 17, 2023

I could have sworn we used to have a warning or error about this.

@athas
Copy link
Member

athas commented Jan 17, 2023

Fixed in 7cb7e64.

@athas athas closed this as completed Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants