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

UTP C++ code syntax error? (first time use) #995

Open
splace opened this issue Jan 17, 2025 · 6 comments
Open

UTP C++ code syntax error? (first time use) #995

splace opened this issue Jan 17, 2025 · 6 comments

Comments

@splace
Copy link

splace commented Jan 17, 2025

Running tool: run +tags

/* run: tags="" Fri 17 Jan 14:28:01 GMT 2025 go version go1.24rc1 linux/amd64
# github.com/anacrolix/go-libutp
In file included from ./utp.h:35,
                 from /var/home/simon/go/pkg/mod/github.com/anacrolix/[email protected]/callbacks.go:4:
./utp_types.h:120:15: error: two or more data types in declaration specifiers
  120 | typedef uint8 bool;
      |               ^~~~

Stopped.

Exited: 15
@anacrolix
Copy link
Owner

Interesting, it's likely an upstream problem. What C++ compiler and set up are you using?

@splace
Copy link
Author

splace commented Jan 19, 2025

didn't include compiler since seems to be a syntax error, ie any/all compilers?

gcc version 15.0.1 20250114 (Red Hat 15.0.1-0) (GCC)

maybe upstream is doing something narrow that doesn't catch this?

@anacrolix
Copy link
Owner

For context, the wrapped library (upstream), is a clunky old half C/half C++ library that gets very little updates. However it is very heavily used and very stable.

I'm happy to accept a patch here for it, GCC has probably changed something, without digging in it looks like it's complaining about the fact bool already exists (in C++) and then has a typedef. It might also come from Go, either way it's new and just a backwards compatibility problem.

@splace
Copy link
Author

splace commented Jan 19, 2025

yes, i did wonder if it was some leftover/boilerplate not actually being used. i didn't find any (from a very quick scan)

@anacrolix
Copy link
Owner

I would guess a recent enough C compiler would include a bool typedef of its own. I suspect the fix will be very simple to add an extra #if guard of some kind to utp_types.h. I took a quick look, my GCC is symlinked to clang 16 and I don't get the issue. I'm not on Linux however.

@anacrolix
Copy link
Owner

I see GCC 15 was just released 2 weeks ago. I have GCC 14, I'll wait for 15 to be available on Homebrew. GCC 14 did not trigger the error you got for me.

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