[PATCH] D50199: [MinGW] Predefine UNICODE if -municode is specified during compilation

Charles Davis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 2 14:31:50 PDT 2018

cdavis5x added a comment.

Are you sure this shouldn't also define `_UNICODE`? //looks// Hmm... GCC doesn't define it. I wonder if we should anyway. A user who set `-municode` may also be using `<tchar.h>`, and thus may want those macros set to their Unicode counterparts.

I actually believe this is supposed to have one other effect: it sets the entry point to `wmainCRTStartup()`/`wWinMainCRTStartup()`, making the user entry point `wmain()`/`wWinMain()`, which take wide arguments:

  int wmain(int argc, wchar_t **argv);
  int WINAPI wWinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPWSTR pwszCmdLine, int nCmdShow);

But that's a link-time effect. I believe it has no bearing on @rnk's comment.

...Actually, that suggests that we may want to warn if the user defines `main()` or `WinMain()` instead of their Unicode counterparts when `-municode` is given--which means we may want to pass it to the frontend after all.


More information about the cfe-commits mailing list