~ubuntu-branches/debian/sid/glib2.0/sid

« back to all changes in this revision

Viewing changes to glib/tests/test-printf.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2013-05-08 06:25:57 UTC
  • mfrom: (1.27.14) (3.1.181 experimental)
  • Revision ID: package-import@ubuntu.com-20130508062557-i7gbku66mls70gi2
Tags: 2.36.1-2
Merge experimental branch, upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
721
721
   * GLib 2.2, so it's best if it continues to work.
722
722
   */
723
723
 
 
724
  /* However, gcc doesn't know about this, so we need to disable printf
 
725
   * format warnings...
 
726
   */
 
727
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 
728
_Pragma ("GCC diagnostic push")
 
729
_Pragma ("GCC diagnostic ignored \"-Wformat\"")
 
730
_Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"")
 
731
#endif
 
732
 
724
733
  res = g_snprintf (buf, 128, "%" "lli", (gint64)123456);
725
734
  g_assert_cmpint (res, ==, 6);
726
735
  g_assert_cmpstr (buf, ==, "123456");
752
761
  res = g_snprintf (buf, 128, "%" "ll" "X", (gint64)123456);
753
762
  g_assert_cmpint (res, ==, 5);
754
763
  g_assert_cmpstr (buf, ==, "1E240");
 
764
 
 
765
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 
766
_Pragma ("GCC diagnostic pop")
 
767
#endif
 
768
 
755
769
#endif
756
770
}
757
771
 
840
854
   * GLib 2.2, so it's best if it continues to work.
841
855
   */
842
856
 
 
857
  /* However, gcc doesn't know about this, so we need to disable printf
 
858
   * format warnings...
 
859
   */
 
860
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 
861
_Pragma ("GCC diagnostic push")
 
862
_Pragma ("GCC diagnostic ignored \"-Wformat\"")
 
863
_Pragma ("GCC diagnostic ignored \"-Wformat-extra-args\"")
 
864
#endif
 
865
 
843
866
  if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT))
844
867
    {
845
868
      res = g_printf ("%" "lli", (gint64)123456);
911
934
    }
912
935
  g_test_trap_assert_passed ();
913
936
  g_test_trap_assert_stdout ("*1E240*");
 
937
 
 
938
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 
939
_Pragma ("GCC diagnostic pop")
 
940
#endif
 
941
 
914
942
#endif
915
943
}
916
944
 
 
945
G_GNUC_PRINTF(1, 2)
917
946
static gsize
918
947
upper_bound (const gchar *format, ...)
919
948
{