Re: How necessary is 'scandir'?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From gcc man page

-w
Inhibit all warning messages.
-Werror
Make all warnings into errors.

From AIX compiler reference

-w
Category
Listings, messages, and compiler information
Chapter 4. Compiler options reference 299
Pragma equivalent
None.
Purpose
Suppresses informational, language-level and warning messages.
This option is equivalent to specifying -qflag=e : e.

Option I believe wanted is -qhalt

==============

-qhalt
Category
Error checking and debugging
Pragma equivalent
#pragma options halt
Purpose
Stops compilation before producing any object, executable, or assembler source
files if the maximum severity of compile-time messages equals or exceeds the
severity you specify.
Syntax
-qhalt syntax — C

s
-qhalt = i
w
e

Defaults
-qhalt=s

Parameters
i Specifies that compilation is to stop for all types of errors: warning, error and
informational. Informational diagnostics (I) are of the lowest severity.
w Specifies that compilation is to stop for warnings (W) and all types of errors.
e Specifies that compilation is to stop for errors (E), severe errors (S), and
unrecoverable errors (U).
s Specifies that compilation is to stop for severe errors (S) and unrecoverable
errors (U).

So, to make a warning a message that halts asif an error is needed


-qhalt=w

This patch:
diff -ur a/configure.ac b/configure.ac
--- a/configure.ac      2015-01-13 03:40:40 +0000
+++ b/configure.ac      2015-02-15 15:49:33 +0000
@@ -159,7 +159,11 @@
 if test "$os_win32" = "no"; then
        AC_MSG_CHECKING([for scandir])
        fc_saved_CFLAGS="$CFLAGS"
+if test "x$GCC" = "xyes"; then
        CFLAGS="$CFLAGS $WARN_CFLAGS -Werror"
+else
+       CFLAGS="$CFLAGS $WARN_CFLAGS"
+fi
        AC_TRY_COMPILE([
                #include <dirent.h>
                int main(void);

resolves the configure issue here

I do not wish to attempt a real fix here - as I disagree with the logic of adding -Werror - in static text.
If a reaction like this is needed it should be a different variable - like WARN_CFLAGS - that gets set per compiler.

Another general problem I see is that --prefix is not being applied by configure (because libraries in /opt/lib, include files in /opt/include - are not being found. Just the standard hard-coded (it seems) check of /usr and /usr/local. Quite common that /usr/local is being checked, while --prefix value is not.

ANYWAY - for the key question - is scandir needed - the problem is configure.ac, not scandir() availability.

On Sun, Feb 15, 2015 at 2:01 PM, Raimund Steger <rs@xxxxxxxx> wrote:
On 02/12/15 03:59, Akira TAGOH wrote:
If the own scandir works on the platforms where don't have POSIX version
of scandir, we could drop that check. if anyone confirm, that would be
appreciated.

The question is, for what cases would we need our own scandir. Because:

(1) On Win32, FcDirChecksum isn't used (we use FcStat/GetFileAttributesEx only)

(2) On all platforms we supported before 38ab7ab2fbd83c0c62e4b78302b5fe89da0cb79e (where the configure check was introduced), scandir *is* available. Either the POSIX one (in the sense of [1]) which uses dirent comparators or the one that uses void* [2].

Because of that, we wouldn't need to specifically test for [1] and could just assume it's there, avoiding clashes with UNIX compilers that can't execute our test because of -Werror.

Now what about platforms where there is indeed neither GetFileAttributesEx nor any version of scandir? I admit that these were probably supported before 0ac6c98294d666762960824d39329459b22b48b7 (https://bugs.freedesktop.org/show_bug.cgi?id=25535) and aren't now. If we wanted to support those, then yes, we would need to check for both scandir versions, although the check for the POSIX variant could be a simple fallback that doesn't need -Werror. And even then, we could probably simply ignore the result of FcIsFsMtimeBroken as the change addressed FAT file systems on UNIX/Linux only. I mean, the set of UNIX/Linux systems that don't have scandir and at the same time use a font directory on FAT is probably rather small...

Raimund


[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html
[2] http://netbsd.gw.com/cgi-bin/man-cgi?scandir+3+NetBSD-current






On Thu, Feb 12, 2015 at 7:55 AM, Raimund Steger <rs@xxxxxxxx
<mailto:rs@xxxxxxxx>> wrote:

    On 02/11/15 19:40, Michael Felt wrote:

        Yes, xlC, and I was hoping it was just a stray gcc flag.


    If that's indeed the reason, you can:

    (0) To confirm whether it is, replace WERROR_CFLAGS="-Werror" with
    WERROR_CFLAGS="" in configure.ac <http://configure.ac>, run
    autoconf, configure etc.

    If that works:

    (1) find an equivalent flag for XL C and create a patch, just like
    the one for SunPRO [1]. If I understand the documentation right [2],
    this could be "-qmaxerr=1:w" (increase the number 1 if some
    'statement not reached' stuff gets in your way), but it's difficult
    to say without an actual installation to test.

    (2) create a patch similar to (1), but set WERROR_CFLAGS="" or
    disable the scandir check altogether when compiling with XL C. I
    believe before [3] there wasn't even a scandir check, and the change
    was only to silence warnings on NetBSD if I read the commit right. I
    doubt you will have any problem on AIX.

    Actually I'm still somewhat unhappy that configure wants to
    acknowledge the POSIX version of scandir specially when only
    recognizing the NetBSD version would probably have sufficed ...
    would have saved us a lot of if's, maybe even the one for $os_win32.

    But I'll shut my mouth again.

    -Raimund



    [1]
    http://cgit.freedesktop.org/__fontconfig/commit/?id=__694368667a15341ea30b37a36e9540__e6b1492680
    <http://cgit.freedesktop.org/fontconfig/commit/?id=694368667a15341ea30b37a36e9540e6b1492680>
    [2]
    http://www-01.ibm.com/support/__knowledgecenter/SSGH2K_13.1.0/__com.ibm.xlc131.aix.doc/__compiler_ref/opt_maxerr.html?__lang=en
    <http://www-01.ibm.com/support/knowledgecenter/SSGH2K_13.1.0/com.ibm.xlc131.aix.doc/compiler_ref/opt_maxerr.html?lang=en>
    [3]
    http://cgit.freedesktop.org/__fontconfig/commit/?id=__38ab7ab2fbd83c0c62e4b78302b5fe__89da0cb79e
    <http://cgit.freedesktop.org/fontconfig/commit/?id=38ab7ab2fbd83c0c62e4b78302b5fe89da0cb79e>






--
Akira TAGOH


--
Worringer Str 31 Duesseldorf 40211 DE  home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346           work: <rs@xxxxxxxxxxxxxxx>

_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux