NetworkManager C99 compiler requirement for 0.9.10 (and therefore 0.9.9)



Hi all,

I would like to do *occasional* C99-style declarations in the code to avoid ugly hacks when using 
conditionally built code. That means bumping up the compiler requirements to the C99 standard. As we 
currently only target to GCC and possibly LLVM, I don't think it would be a problem.

I will modify the configure.ac to require and use C99, if there are no objections on the list.

Below you can see an example of code that would benefit from moving conditional stuff together.

Cheers,

Pavel


static void
test_loopback ()
{
#if !KERNEL_HACKS
        gboolean link_was_up;
#endif
        gboolean link_exists = FALSE;

        /* Loopback device exists and has the correct name and index */
        g_assert (nm_platform_link_exists (LO_NAME));
        g_assert (nm_platform_link_get_type (LO_INDEX) == NM_LINK_TYPE_GENERIC);
        g_assert (nm_platform_link_get_index (LO_NAME) == LO_INDEX);
        g_assert (!g_strcmp0(nm_platform_link_get_name (LO_INDEX), LO_NAME));

        /* Foreach */
        nm_platform_link_foreach (loopback_check, &link_exists);
        g_assert (link_exists);

#if !KERNEL_HACKS
        /* Current kernels may break IPv6 networking when performing this test:
         *
         * https://bugzilla.redhat.com/show_bug.cgi?id=886116
         *
         * We're therefore disabling it as a hack to preserve connectivity on
         * kernels that would break it.
         */
        /* Loopback can be set up and down */
        link_was_up = nm_platform_link_is_up (LO_INDEX);
        g_assert (nm_platform_link_set_up (LO_INDEX));
        g_assert (nm_platform_link_is_up (LO_INDEX));
        g_assert (nm_platform_link_is_connected (LO_INDEX));


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