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

[vcpkg] Fix forward declarations and missing pragma once #12836

Closed

Conversation

cngzhnp
Copy link
Contributor

@cngzhnp cngzhnp commented Aug 9, 2020

Most of the header files does contain a forward declaration for some incomplete types. In this pull request, I tried to add them to break the dependency between header files as well.

On the other hand, buildenvironment.h file does not contain "pragma once" and fixed.

@ghost
Copy link

ghost commented Aug 9, 2020

CLA assistant check
All CLA requirements met.

@PhoebeHui PhoebeHui changed the title Fix forward declarations and missing pragma once [vcpkg] Fix forward declarations and missing pragma once Aug 10, 2020
@strega-nil
Copy link
Contributor

strega-nil commented Aug 10, 2020

@cngzhnp Could you instead add a -fwd file for all of these, instead of just declaring the types? Also, we are not allowed to forward declare types from the standard library, so that -fwd file will have to include <filesystem>.

toolsrc/include/vcpkg/archives.h Outdated Show resolved Hide resolved
@JackBoosY JackBoosY added category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) requires:author-response labels Aug 11, 2020
@cngzhnp cngzhnp force-pushed the cngzhnp/fix_forward_declarations branch 2 times, most recently from e3f28d0 to eff34ae Compare August 11, 2020 21:45
@cngzhnp
Copy link
Contributor Author

cngzhnp commented Aug 12, 2020

There was a failure on the pipeline but I checked the logs, assume no related with my changes. Could you please restart the pipeline and review my changes?

@JackBoosY
Copy link
Contributor

Some of them are related:

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /Volumes/data/work/3/s/toolsrc/build.rel
[0/2] Re-checking globbed directories...
[1/106] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/chrono.cpp.o
[2/106] Building CXX object CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o
FAILED: CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/g++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -std=c++17 -MD -MT CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o -MF CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o.d -o CMakeFiles/vcpkg.dir/src/vcpkg.cpp.o -c ../src/vcpkg.cpp
In file included from ../src/vcpkg.cpp:11:
In file included from ../include/vcpkg/commands.contact.h:3:
../include/vcpkg/commands.interface.h:9:12: error: forward declaration of struct cannot have a nested name specifier
    struct Files::Filesystem;
           ^~~~~~~
1 error generated.
[3/106] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.build.cpp.o
FAILED: CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.build.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/g++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -std=c++17 -MD -MT CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.build.cpp.o -MF CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.build.cpp.o.d -o CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.build.cpp.o -c ../src/vcpkg-test/commands.build.cpp
In file included from ../src/vcpkg-test/commands.build.cpp:5:
In file included from ../include/vcpkg/commands.h:3:
In file included from ../include/vcpkg/build.h:9:
In file included from ../include/vcpkg/commands.integrate.h:3:
../include/vcpkg/commands.interface.h:9:12: error: forward declaration of struct cannot have a nested name specifier
    struct Files::Filesystem;
           ^~~~~~~
1 error generated.
[4/106] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/binarycaching.cpp.o
FAILED: CMakeFiles/vcpkg-test.dir/src/vcpkg-test/binarycaching.cpp.o 
/Library/Developer/CommandLineTools/usr/bin/g++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -std=c++17 -MD -MT CMakeFiles/vcpkg-test.dir/src/vcpkg-test/binarycaching.cpp.o -MF CMakeFiles/vcpkg-test.dir/src/vcpkg-test/binarycaching.cpp.o.d -o CMakeFiles/vcpkg-test.dir/src/vcpkg-test/binarycaching.cpp.o -c ../src/vcpkg-test/binarycaching.cpp
In file included from ../src/vcpkg-test/binarycaching.cpp:6:
In file included from ../include/vcpkg/binarycaching.private.h:3:
In file included from ../include/vcpkg/dependencies.h:6:
In file included from ../include/vcpkg/build.h:9:
In file included from ../include/vcpkg/commands.integrate.h:3:
../include/vcpkg/commands.interface.h:9:12: error: forward declaration of struct cannot have a nested name specifier
    struct Files::Filesystem;
           ^~~~~~~
1 error generated.
[5/106] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/binaryconfigparser.cpp.o
[6/106] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/arguments.cpp.o
[7/106] Building CXX object CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.cpp.o
FAILED: CMakeFiles/vcpkg-test.dir/src/vcpkg-test/commands.cpp.o 

@cngzhnp cngzhnp force-pushed the cngzhnp/fix_forward_declarations branch from eff34ae to 8eeed12 Compare August 12, 2020 07:35
@strega-nil
Copy link
Contributor

/Library/Developer/CommandLineTools/usr/bin/g++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -include /Volumes/data/work/3/s/toolsrc/include/pch.h -std=c++17 -MD -MT CMakeFiles/vcpkglib.dir/src/vcpkg/commands.xvsinstances.cpp.o -MF CMakeFiles/vcpkglib.dir/src/vcpkg/commands.xvsinstances.cpp.o.d -o CMakeFiles/vcpkglib.dir/src/vcpkg/commands.xvsinstances.cpp.o -c ../src/vcpkg/commands.xvsinstances.cpp
../src/vcpkg/commands.xvsinstances.cpp:30:9: error: use of undeclared identifier 'Util'
        Util::unused(args, paths);

Could you remove Util::unused and switch to (void)?

@cngzhnp cngzhnp force-pushed the cngzhnp/fix_forward_declarations branch from 8eeed12 to 63f3bb7 Compare August 12, 2020 18:33
@cngzhnp
Copy link
Contributor Author

cngzhnp commented Aug 12, 2020

/Library/Developer/CommandLineTools/usr/bin/g++  -DVCPKG_USE_STD_FILESYSTEM=1 -I../include -O3 -DNDEBUG -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk   -include /Volumes/data/work/3/s/toolsrc/include/pch.h -std=c++17 -MD -MT CMakeFiles/vcpkglib.dir/src/vcpkg/commands.xvsinstances.cpp.o -MF CMakeFiles/vcpkglib.dir/src/vcpkg/commands.xvsinstances.cpp.o.d -o CMakeFiles/vcpkglib.dir/src/vcpkg/commands.xvsinstances.cpp.o -c ../src/vcpkg/commands.xvsinstances.cpp
../src/vcpkg/commands.xvsinstances.cpp:30:9: error: use of undeclared identifier 'Util'
        Util::unused(args, paths);

Could you remove Util::unused and switch to (void)?

@strega-nil Done.

@cngzhnp cngzhnp force-pushed the cngzhnp/fix_forward_declarations branch from 63f3bb7 to e1264a4 Compare August 15, 2020 11:10
@cngzhnp
Copy link
Contributor Author

cngzhnp commented Aug 15, 2020

I do not understand that why "extern const CommandStructure COMMAND_STRUCTURE;" is added on some header files (maybe pre-work for next features) but it makes extra dependent header files to vcpkgcmdarguments.h.

@JackBoosY
Copy link
Contributor

@strega-nil Ping for review.

@@ -27,7 +27,7 @@ namespace vcpkg::Commands::X_VSInstances

Checks::exit_success(VCPKG_LINE_INFO);
#else
Util::unused(args, paths);
(void)(args, paths);
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to see complete elimination of Util::unused but that's a separate change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was requested from @strega-nil. Not related with context but added.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I mean do what she asked but for all callers of Util::unused rather than just here.

@strega-nil
Copy link
Contributor

I'd like to see something like cngzhnp#1 used instead, since I don't like copy-pasting things that we can get the compiler to copy-paste for us.

@BillyONeal
Copy link
Member

@strega-nil Can you clarify: are you saying this PR should rejected for now? (If so, can you mark it 'waiting'/'request changes'?)

Copy link
Contributor

@strega-nil strega-nil left a comment

Choose a reason for hiding this comment

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

Could we do cngzhnp#1 instead?

@cngzhnp
Copy link
Contributor Author

cngzhnp commented Aug 19, 2020

@strega-nil From my point of view, LGTM.

@BillyONeal
Copy link
Member

@cngzhnp Thanks for your contribution! I'm closing this in favor of #12985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants