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

fl_scandir && scandir_posix.c #183

Closed
markjolesen opened this issue Jan 26, 2021 · 5 comments
Closed

fl_scandir && scandir_posix.c #183

markjolesen opened this issue Jan 26, 2021 · 5 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@markjolesen
Copy link

if USE_X11 is defined but HAVE_SCANDIR is undefined, you will get a linker error because fl_scandiir is not implemented

@Albrecht-S
Copy link
Member

Please tell us your build type (autoconf/make or CMake) and system platform. Is this still on FreeDOS?

Also, please tell us how it comes that USE_X11 is defined on your system, i.e. what environment or build option makes this defined?

@markjolesen
Copy link
Author

markjolesen commented Jan 27, 2021 via email

@Albrecht-S
Copy link
Member

@markjolesen I'm not sure I understand your statements. I analyzed the code and came to this conclusion (please correct me if I misunderstood something or my conclusion is wrong):

Our only "use case" is to build the FLTK library and fl_scandir() is not part of the public API. You wrote:

if USE_X11 is defined but HAVE_SCANDIR is undefined, you will get a linker error because fl_scandiir is not implemented

That's obviously wrong (maybe a typo?) because the condition is:
#if defined(USE_X11) && !defined(HAVE_SCANDIR)

... but anyway: this is the only condition when fl_scandir() needs to be defined. It is called exactly once in Fl_X11_System_Driver.cxx, line 485:

Fl_X11_System_Driver.cxx-483-#ifndef HAVE_SCANDIR
Fl_X11_System_Driver.cxx-484-  // This version is when we define our own scandir. Note it updates errmsg on errors.
Fl_X11_System_Driver.cxx:485:  int n = fl_scandir(dirloc, list, 0, sort, errmsg, errmsg_sz);
Fl_X11_System_Driver.cxx-486-#elif defined(HAVE_SCANDIR_POSIX)
Fl_X11_System_Driver.cxx-487-  // POSIX (2008) defines the comparison function like this:
Fl_X11_System_Driver.cxx-488-  int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent **))sort);
Fl_X11_System_Driver.cxx-489-#elif defined(__osf__)
. . .

The (otherwise) "empty" #else case at the end of the file has this dummy typedef only to silence a compiler warning. So I am pretty sure there's nothing wrong with the code as-is. Note also that this file is only compiled if USE_X11 is defined (this condition could be removed, it's a leftover from previous versions).

@markjolesen
Copy link
Author

markjolesen commented Feb 15, 2021 via email

@Albrecht-S Albrecht-S self-assigned this Feb 15, 2021
@Albrecht-S Albrecht-S added the wontfix This will not be worked on label Feb 15, 2021
@Albrecht-S
Copy link
Member

OK, I'm leaving everything as-is for now. We will have a check of the new source code WRT such defines and #ifdef's before we release 1.4.0.

I'm closing this with label "wontfix" because there's nothing to "fix", thanks for your report anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants