View | Details | Return to bug 61407 | Differences between
and this patch

Collapse All | Expand All

(-)gcc/config/darwin-c.c.orig (-18 / +48 lines)
Lines 933-956 find_subframework_header (cpp_reader *pf Link Here
933
   Print a warning if the version number is not known.  */
933
   Print a warning if the version number is not known.  */
934
static const char *
934
static const char *
935
/* APPLE LOCAL ARM 5683689 */
935
/* APPLE LOCAL ARM 5683689 */
936
macosx_version_as_macro (void)
936
legacy_version_as_macro (const char *version_str)
937
{
937
{
938
  static char result[] = "1000";
938
  static char result[] = "1000";
939
939
940
  if (strncmp (darwin_macosx_version_min, "10.", 3) != 0)
940
  if (strncmp (version_str, "10.", 3) != 0)
941
    goto fail;
941
    goto fail;
942
  if (! ISDIGIT (darwin_macosx_version_min[3]))
942
  if (! ISDIGIT (version_str[3]))
943
    goto fail;
943
    goto fail;
944
  result[2] = darwin_macosx_version_min[3];
944
  result[2] = version_str[3];
945
  if (darwin_macosx_version_min[4] != '\0')
945
  if (version_str[4] != '\0')
946
    {
946
    {
947
      if (darwin_macosx_version_min[4] != '.')
947
      if (version_str[4] != '.')
948
	goto fail;
948
	goto fail;
949
      if (! ISDIGIT (darwin_macosx_version_min[5]))
949
      if (! ISDIGIT (version_str[5]))
950
	goto fail;
950
	goto fail;
951
      if (darwin_macosx_version_min[6] != '\0')
951
      if (version_str[6] != '\0')
952
	goto fail;
952
	goto fail;
953
      result[3] = darwin_macosx_version_min[5];
953
      result[3] = version_str[5];
954
    }
954
    }
955
  else
955
  else
956
    result[3] = '0';
956
    result[3] = '0';
Lines 958-966 macosx_version_as_macro (void) Link Here
958
  return result;
958
  return result;
959
959
960
 fail:
960
 fail:
961
  error ("Unknown value %qs of -mmacosx-version-min",
961
  return NULL;
962
	 darwin_macosx_version_min);
963
  return "1000";
964
}
962
}
965
963
966
/* APPLE LOCAL begin ARM 5683689 */
964
/* APPLE LOCAL begin ARM 5683689 */
Lines 972-984 macosx_version_as_macro (void) Link Here
972
   defaults to '00' if not specified.  In the case of a parse error,
970
   defaults to '00' if not specified.  In the case of a parse error,
973
   print a warning and return 10200.  */
971
   print a warning and return 10200.  */
974
static const char *
972
static const char *
975
iphoneos_version_as_macro (void)
973
modern_version_as_macro (const char *version_str)
976
{
974
{
977
  static char result[sizeof ("99.99.99") + 1];
975
  static char result[sizeof ("99.99.99") + 1];
978
  const char *src_ptr = darwin_iphoneos_version_min;
976
  const char *src_ptr = version_str;
979
  char *result_ptr = &result[0];
977
  char *result_ptr = &result[0];
980
978
981
  if (! darwin_iphoneos_version_min)
979
  if (! version_str)
982
    goto fail;
980
    goto fail;
983
981
984
  if (! ISDIGIT (*src_ptr))
982
  if (! ISDIGIT (*src_ptr))
Lines 1032-1041 iphoneos_version_as_macro (void) Link Here
1032
  return result;
1030
  return result;
1033
  
1031
  
1034
 fail:
1032
 fail:
1035
  error ("Unknown value %qs of -miphoneos-version-min",
1033
  return NULL;
1036
	 darwin_iphoneos_version_min);
1034
}
1037
  return "10200";
1035
1036
static const char *
1037
iphoneos_version_as_macro (void)
1038
{
1039
    static const char *result;
1040
    result = modern_version_as_macro(darwin_iphoneos_version_min);
1041
1042
    if (!result) {
1043
        error ("Unknown value %qs of -miphoneos-version-min",
1044
               darwin_iphoneos_version_min);
1045
        return "10200";
1046
    }
1047
1048
    return result;
1038
}
1049
}
1050
1051
static const char *
1052
macosx_version_as_macro (void)
1053
{
1054
    static const char *result;
1055
    result = legacy_version_as_macro(darwin_macosx_version_min);
1056
1057
    if (!result)
1058
        result = modern_version_as_macro(darwin_macosx_version_min);
1059
1060
    if (!result) {
1061
        error ("Unknown value %qs of -mmacosx-version-min",
1062
               darwin_macosx_version_min);
1063
        return "1000";
1064
    }
1065
1066
    return result;
1067
}
1068
1039
/* APPLE LOCAL end ARM 5683689 */
1069
/* APPLE LOCAL end ARM 5683689 */
1040
1070
1041
/* Define additional CPP flags for Darwin.   */
1071
/* Define additional CPP flags for Darwin.   */

Return to bug 61407