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

WProgram.h error: functions that differ only in their return type cannot be overloaded #17

Open
SimonSapin opened this issue Apr 17, 2017 · 1 comment

Comments

@SimonSapin
Copy link
Collaborator

I’m preparing a pull request that uses https://github.com/PaulStoffregen/cores/ as a submodule rather than having a copy of it in this repository, and also running rust-bindgen when building the teensy-sys crate. Bindgen (or presumably libclang, which bindgen uses) fails with this error:

cores/teensy3/WProgram.h:53:9: error: functions that differ only in their return type cannot be overloaded
/usr/include/stdlib.h:298:17: note: previous declaration is here

The first source line referenced is:

// WMath prototypes
int32_t random(void);

The second (on my system, Archlinux x86_64) is:

/* Return a random long integer between 0 and RAND_MAX inclusive.  */
extern long int random (void) __THROW;

I believe that long int is the same as int32_t on thumbv7em-none-eabi, but libclang seem to consider them different anyway. Changing the first line to use long works around the problem, but I’d rather not maintain a fork of the repository. So for now I’m adding a hack in teensy-sys/build.rs that does this replacement into a temporary file.

This issue is about getting rid of this hack eventually. Sending a pull request upstream would be best, but for now I don’t know if simply changing uint32_t to long is appropriate.

CC PaulStoffregen/cores#187, PaulStoffregen/cores#83

@danwalmsley
Copy link

I have also just come across this issue when using the Clang compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants