Skip to content

Conversation

@Febbe
Copy link

@Febbe Febbe commented Sep 24, 2025

Fixes #98

Copy link
Contributor

@Croydon Croydon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of changes that are unrelated to increase the minimum CMake version, and many of those changes are non-obvious, that require much more explanation of their motivation and effects IMHO.

@@ -1,69 +1,58 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.21.0)
if(POLICY CMP0177)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is CMake 3.31+ only and could unexpectely change behaviour based on CMake version https://cmake.org/cmake/help/v3.31/policy/CMP0177.html

Seems unnecessary

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is, we already have CMake 4.x and CMake doesn't support this POLICY at some point. So it issues many warnings. It seems to work fine with the new policy if available.

I can test other ways to silence those warnings. Maybe setting that POLICY explicitly to OLD.


if(NOT MSVC)
message( WARNING "Visual Studio Build supported only" )
message(FATAL_ERROR "Visual Studio Build supported only" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might break exotic configurations that actually work, for basically no advantage.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will remove it.

@@ -0,0 +1,5 @@
mkdir CMakeBuildClangCl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should stop adding more of those bat files. In times where CMake is well integrated in editors, we really shouldn't need them. There are highly unflexible anyway

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll remove it, shall I remove the others too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just my make my role here clear: I contributed to winflexbison before, but I have no official say here in any way. So I am stating my own personal opinions here.

I am not sure if someone still relies on the existing bat files, but since the development of winflexbison is mostly dead, it can't affect too many people for sure, if we would remove all of them. But maybe this is something for another pull request.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another pull request it is... concerning cmake I'll let @Croydon decide, for the rest... stay compatible :-)


extern int strverscmp(const char* s1, const char* s2);

struct obstack;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does a CMake version increase require a code change like this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the cmake bump itself, but that code boils out with clang-cl.

The declaration of struct obstack in the functions parameter list is not visible to the outside. It is basically static.

clang is more strict and interprets it as a different declaration each time this file is included and linked. Therefore we get ODR violations on link time.

#define _MODE_T_
typedef int mode_t;
#endif
#endif /* _MODE_T_ */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, although unrelated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not unrelated, since it's required to work with clang-cl.
Clang-cl uses vcruntime and MSVC-STL so no mode_t is defined, but clang obviously defines clang.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my bad. I was too focused on CMake version adaptations, so I forgot that you want to fix clang-cl midway.

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.20.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use 3.20.0 here, if you propose 3.21.0 for the parent project and bison?

add_compile_definitions("__extension__=")
endif()

#if (MSVC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those comments can easily be interpreted as actual code and are confusing.

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}/bin/Release")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_CURRENT_BINARY_DIR}/bin/RelWithDebInfo")
endif()
# Only apply to MSVC frontend (not clang frontends)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing is off

Comment on lines +18 to +19
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /EHsc")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /GL /Oi /Gy")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed this from CXX to C, since all projects are C projects. Those settings had zero effect before.
Shall I remove those lines (behavior unchanged) or use the new flags (lot of warnings, most likely unused intended behavior).

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

Successfully merging this pull request may close these issues.

Project is incompatible with modern tools

3 participants