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

[clang-format] Misformatted address-of operator after cast on 20 versus 19 #125012

Open
rmarker opened this issue Jan 30, 2025 · 3 comments
Open

Comments

@rmarker
Copy link
Contributor

rmarker commented Jan 30, 2025

While testing on the release branch for 20, I discovered this formatting change from 19.1.0.

Using 19.1.0:

::gluTessCallback(tesselator.get(), GLU_TESS_COMBINE_DATA,
                  (GLvoid(FONM_GLU_STD_CALLBACK *)())&CallbackCombine);

Using 20 (8c25748):

::gluTessCallback(tesselator.get(), GLU_TESS_COMBINE_DATA,
                  (GLvoid(FONM_GLU_STD_CALLBACK *)()) & CallbackCombine);
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/issue-subscribers-clang-format

Author: None (rmarker)

While testing on the release branch for 20, I discovered this formatting change from 19.1.0.

Using 19.1.0:

::gluTessCallback(tesselator.get(), GLU_TESS_COMBINE_DATA,
                  (GLvoid(FONM_GLU_STD_CALLBACK *)())&CallbackCombine);

Using 20 (8c25748):

::gluTessCallback(tesselator.get(), GLU_TESS_COMBINE_DATA,
                  (GLvoid(FONM_GLU_STD_CALLBACK *)()) & CallbackCombine);

@owenca
Copy link
Contributor

owenca commented Jan 31, 2025

While testing on the release branch for 20, I discovered this formatting change from 19.1.0.

Using 19.1.0:

::gluTessCallback(tesselator.get(), GLU_TESS_COMBINE_DATA,
(GLvoid(FONM_GLU_STD_CALLBACK *)())&CallbackCombine);
Using 20 (8c25748):

::gluTessCallback(tesselator.get(), GLU_TESS_COMBINE_DATA,
(GLvoid(FONM_GLU_STD_CALLBACK *)()) & CallbackCombine);

Is GLvoid a macro? What's it defined as? It's likely that 19.1.0 got it right by chance, and you need to add something like Macros: [GLvoid(a)=void(*)] to your config file after bcd586b.

@rmarker
Copy link
Contributor Author

rmarker commented Jan 31, 2025

GLvoid isn't a macro. It is a type provided by OpenGL. I.e. via typedef void GLvoid.
Though, adding that macro configuration you suggested, does cause the old formatting to return? Though, I wouldn't think that would be necessary in this instance.
The only macros in that example are FONM_GLU_STD_CALLBACK and GLU_TESS_COMBINE_DATA.

Looking further, I found another example that seems like it could be the same issue. But this one doesn't have any macros present.

19.1.0

Fooooooooooooooooooooo((Type(Baaaaaaaaaaaaaaaaaaar::*)(
    void))&Baaaaaaaaaaaaaaaaaaar::Loooooooooooooooooooooooooooooong);

20

Fooooooooooooooooooooo(
    (Type(Baaaaaaaaaaaaaaaaaaar::*)(void)) &
    Baaaaaaaaaaaaaaaaaaar::Loooooooooooooooooooooooooooooong);

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

4 participants