diff --git a/gcc/config/avr/avr-c.cc b/gcc/config/avr/avr-c.cc index a12240292b1..60905a76556 100644 --- a/gcc/config/avr/avr-c.cc +++ b/gcc/config/avr/avr-c.cc @@ -61,190 +61,190 @@ avr_resolve_overloaded_builtin (unsigned int iloc, tree fndecl, void *vargs) case AVR_BUILTIN_ABSFX: if (args.length() != 1) - { - error_at (loc, "%qs expects 1 argument but %d given", - "absfx", (int) args.length()); + { + error_at (loc, "%qs expects 1 argument but %d given", + "absfx", (int) args.length()); - fold = error_mark_node; - break; - } + fold = error_mark_node; + break; + } type0 = TREE_TYPE (args[0]); if (!FIXED_POINT_TYPE_P (type0)) - { - error_at (loc, "%qs expects a fixed-point value as argument", - "absfx"); + { + error_at (loc, "%qs expects a fixed-point value as argument", + "absfx"); - fold = error_mark_node; - } + fold = error_mark_node; + } switch (TYPE_MODE (type0)) - { - case E_QQmode: id = AVR_BUILTIN_ABSHR; break; - case E_HQmode: id = AVR_BUILTIN_ABSR; break; - case E_SQmode: id = AVR_BUILTIN_ABSLR; break; - case E_DQmode: id = AVR_BUILTIN_ABSLLR; break; - - case E_HAmode: id = AVR_BUILTIN_ABSHK; break; - case E_SAmode: id = AVR_BUILTIN_ABSK; break; - case E_DAmode: id = AVR_BUILTIN_ABSLK; break; - case E_TAmode: id = AVR_BUILTIN_ABSLLK; break; - - case E_UQQmode: - case E_UHQmode: - case E_USQmode: - case E_UDQmode: - case E_UHAmode: - case E_USAmode: - case E_UDAmode: - case E_UTAmode: - warning_at (loc, 0, "using %qs with unsigned type has no effect", - "absfx"); - return args[0]; - - default: - error_at (loc, "no matching fixed-point overload found for %qs", - "absfx"); - - fold = error_mark_node; - break; - } + { + case E_QQmode: id = AVR_BUILTIN_ABSHR; break; + case E_HQmode: id = AVR_BUILTIN_ABSR; break; + case E_SQmode: id = AVR_BUILTIN_ABSLR; break; + case E_DQmode: id = AVR_BUILTIN_ABSLLR; break; + + case E_HAmode: id = AVR_BUILTIN_ABSHK; break; + case E_SAmode: id = AVR_BUILTIN_ABSK; break; + case E_DAmode: id = AVR_BUILTIN_ABSLK; break; + case E_TAmode: id = AVR_BUILTIN_ABSLLK; break; + + case E_UQQmode: + case E_UHQmode: + case E_USQmode: + case E_UDQmode: + case E_UHAmode: + case E_USAmode: + case E_UDAmode: + case E_UTAmode: + warning_at (loc, 0, "using %qs with unsigned type has no effect", + "absfx"); + return args[0]; + + default: + error_at (loc, "no matching fixed-point overload found for %qs", + "absfx"); + + fold = error_mark_node; + break; + } fold = targetm.builtin_decl (id, true); if (fold != error_mark_node) - fold = build_function_call_vec (loc, vNULL, fold, &args, NULL); + fold = build_function_call_vec (loc, vNULL, fold, &args, NULL); break; // absfx case AVR_BUILTIN_ROUNDFX: if (args.length() != 2) - { - error_at (loc, "%qs expects 2 arguments but %d given", - "roundfx", (int) args.length()); + { + error_at (loc, "%qs expects 2 arguments but %d given", + "roundfx", (int) args.length()); - fold = error_mark_node; - break; - } + fold = error_mark_node; + break; + } type0 = TREE_TYPE (args[0]); type1 = TREE_TYPE (args[1]); if (!FIXED_POINT_TYPE_P (type0)) - { - error_at (loc, "%qs expects a fixed-point value as first argument", - "roundfx"); + { + error_at (loc, "%qs expects a fixed-point value as first argument", + "roundfx"); - fold = error_mark_node; - } + fold = error_mark_node; + } if (!INTEGRAL_TYPE_P (type1)) - { - error_at (loc, "%qs expects an integer value as second argument", - "roundfx"); + { + error_at (loc, "%qs expects an integer value as second argument", + "roundfx"); - fold = error_mark_node; - } + fold = error_mark_node; + } switch (TYPE_MODE (type0)) - { - case E_QQmode: id = AVR_BUILTIN_ROUNDHR; break; - case E_HQmode: id = AVR_BUILTIN_ROUNDR; break; - case E_SQmode: id = AVR_BUILTIN_ROUNDLR; break; - case E_DQmode: id = AVR_BUILTIN_ROUNDLLR; break; - - case E_UQQmode: id = AVR_BUILTIN_ROUNDUHR; break; - case E_UHQmode: id = AVR_BUILTIN_ROUNDUR; break; - case E_USQmode: id = AVR_BUILTIN_ROUNDULR; break; - case E_UDQmode: id = AVR_BUILTIN_ROUNDULLR; break; - - case E_HAmode: id = AVR_BUILTIN_ROUNDHK; break; - case E_SAmode: id = AVR_BUILTIN_ROUNDK; break; - case E_DAmode: id = AVR_BUILTIN_ROUNDLK; break; - case E_TAmode: id = AVR_BUILTIN_ROUNDLLK; break; - - case E_UHAmode: id = AVR_BUILTIN_ROUNDUHK; break; - case E_USAmode: id = AVR_BUILTIN_ROUNDUK; break; - case E_UDAmode: id = AVR_BUILTIN_ROUNDULK; break; - case E_UTAmode: id = AVR_BUILTIN_ROUNDULLK; break; - - default: - error_at (loc, "no matching fixed-point overload found for %qs", - "roundfx"); - - fold = error_mark_node; - break; - } + { + case E_QQmode: id = AVR_BUILTIN_ROUNDHR; break; + case E_HQmode: id = AVR_BUILTIN_ROUNDR; break; + case E_SQmode: id = AVR_BUILTIN_ROUNDLR; break; + case E_DQmode: id = AVR_BUILTIN_ROUNDLLR; break; + + case E_UQQmode: id = AVR_BUILTIN_ROUNDUHR; break; + case E_UHQmode: id = AVR_BUILTIN_ROUNDUR; break; + case E_USQmode: id = AVR_BUILTIN_ROUNDULR; break; + case E_UDQmode: id = AVR_BUILTIN_ROUNDULLR; break; + + case E_HAmode: id = AVR_BUILTIN_ROUNDHK; break; + case E_SAmode: id = AVR_BUILTIN_ROUNDK; break; + case E_DAmode: id = AVR_BUILTIN_ROUNDLK; break; + case E_TAmode: id = AVR_BUILTIN_ROUNDLLK; break; + + case E_UHAmode: id = AVR_BUILTIN_ROUNDUHK; break; + case E_USAmode: id = AVR_BUILTIN_ROUNDUK; break; + case E_UDAmode: id = AVR_BUILTIN_ROUNDULK; break; + case E_UTAmode: id = AVR_BUILTIN_ROUNDULLK; break; + + default: + error_at (loc, "no matching fixed-point overload found for %qs", + "roundfx"); + + fold = error_mark_node; + break; + } fold = targetm.builtin_decl (id, true); if (fold != error_mark_node) - fold = build_function_call_vec (loc, vNULL, fold, &args, NULL); + fold = build_function_call_vec (loc, vNULL, fold, &args, NULL); break; // roundfx case AVR_BUILTIN_COUNTLSFX: if (args.length() != 1) - { - error_at (loc, "%qs expects 1 argument but %d given", - "countlsfx", (int) args.length()); + { + error_at (loc, "%qs expects 1 argument but %d given", + "countlsfx", (int) args.length()); - fold = error_mark_node; - break; - } + fold = error_mark_node; + break; + } type0 = TREE_TYPE (args[0]); if (!FIXED_POINT_TYPE_P (type0)) - { - error_at (loc, "%qs expects a fixed-point value as first argument", - "countlsfx"); + { + error_at (loc, "%qs expects a fixed-point value as first argument", + "countlsfx"); - fold = error_mark_node; - } + fold = error_mark_node; + } switch (TYPE_MODE (type0)) - { - case E_QQmode: id = AVR_BUILTIN_COUNTLSHR; break; - case E_HQmode: id = AVR_BUILTIN_COUNTLSR; break; - case E_SQmode: id = AVR_BUILTIN_COUNTLSLR; break; - case E_DQmode: id = AVR_BUILTIN_COUNTLSLLR; break; - - case E_UQQmode: id = AVR_BUILTIN_COUNTLSUHR; break; - case E_UHQmode: id = AVR_BUILTIN_COUNTLSUR; break; - case E_USQmode: id = AVR_BUILTIN_COUNTLSULR; break; - case E_UDQmode: id = AVR_BUILTIN_COUNTLSULLR; break; - - case E_HAmode: id = AVR_BUILTIN_COUNTLSHK; break; - case E_SAmode: id = AVR_BUILTIN_COUNTLSK; break; - case E_DAmode: id = AVR_BUILTIN_COUNTLSLK; break; - case E_TAmode: id = AVR_BUILTIN_COUNTLSLLK; break; - - case E_UHAmode: id = AVR_BUILTIN_COUNTLSUHK; break; - case E_USAmode: id = AVR_BUILTIN_COUNTLSUK; break; - case E_UDAmode: id = AVR_BUILTIN_COUNTLSULK; break; - case E_UTAmode: id = AVR_BUILTIN_COUNTLSULLK; break; - - default: - error_at (loc, "no matching fixed-point overload found for %qs", - "countlsfx"); - - fold = error_mark_node; - break; - } + { + case E_QQmode: id = AVR_BUILTIN_COUNTLSHR; break; + case E_HQmode: id = AVR_BUILTIN_COUNTLSR; break; + case E_SQmode: id = AVR_BUILTIN_COUNTLSLR; break; + case E_DQmode: id = AVR_BUILTIN_COUNTLSLLR; break; + + case E_UQQmode: id = AVR_BUILTIN_COUNTLSUHR; break; + case E_UHQmode: id = AVR_BUILTIN_COUNTLSUR; break; + case E_USQmode: id = AVR_BUILTIN_COUNTLSULR; break; + case E_UDQmode: id = AVR_BUILTIN_COUNTLSULLR; break; + + case E_HAmode: id = AVR_BUILTIN_COUNTLSHK; break; + case E_SAmode: id = AVR_BUILTIN_COUNTLSK; break; + case E_DAmode: id = AVR_BUILTIN_COUNTLSLK; break; + case E_TAmode: id = AVR_BUILTIN_COUNTLSLLK; break; + + case E_UHAmode: id = AVR_BUILTIN_COUNTLSUHK; break; + case E_USAmode: id = AVR_BUILTIN_COUNTLSUK; break; + case E_UDAmode: id = AVR_BUILTIN_COUNTLSULK; break; + case E_UTAmode: id = AVR_BUILTIN_COUNTLSULLK; break; + + default: + error_at (loc, "no matching fixed-point overload found for %qs", + "countlsfx"); + + fold = error_mark_node; + break; + } fold = targetm.builtin_decl (id, true); if (fold != error_mark_node) - fold = build_function_call_vec (loc, vNULL, fold, &args, NULL); + fold = build_function_call_vec (loc, vNULL, fold, &args, NULL); break; // countlsfx } return fold; } - + /* Implement `REGISTER_TARGET_PRAGMAS'. */ @@ -264,7 +264,7 @@ avr_register_target_pragmas (void) gcc_assert (i == avr_addrspace[i].id); if (!ADDR_SPACE_GENERIC_P (i)) - c_register_addr_space (avr_addrspace[i].name, avr_addrspace[i].id); + c_register_addr_space (avr_addrspace[i].name, avr_addrspace[i].id); } targetm.resolve_overloaded_builtin = avr_resolve_overloaded_builtin; @@ -333,21 +333,21 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) cpp_define (pfile, "__AVR_TINY__"); /* Define macro "__AVR_TINY_PM_BASE_ADDRESS__" with mapped program memory - start address. This macro shall be used where mapped program - memory is accessed, eg. copying data section (__do_copy_data) - contents to data memory region. - NOTE: - Program memory of AVR_TINY devices cannot be accessed directly, - it has been mapped to the data memory. For AVR_TINY devices - (ATtiny4/5/9/10/20 and 40) mapped program memory starts at 0x4000. */ + start address. This macro shall be used where mapped program + memory is accessed, eg. copying data section (__do_copy_data) + contents to data memory region. + NOTE: + Program memory of AVR_TINY devices cannot be accessed directly, + it has been mapped to the data memory. For AVR_TINY devices + (ATtiny4/5/9/10/20 and 40) mapped program memory starts at 0x4000. */ cpp_define_formatted (pfile, "__AVR_TINY_PM_BASE_ADDRESS__=0x%x", - avr_arch->flash_pm_offset); + avr_arch->flash_pm_offset); } if (avr_arch->flash_pm_offset) cpp_define_formatted (pfile, "__AVR_PM_BASE_ADDRESS__=0x%x", - avr_arch->flash_pm_offset); + avr_arch->flash_pm_offset); if (AVR_HAVE_EIJMP_EICALL) { @@ -377,14 +377,14 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) cpp_define (pfile, "__AVR_ERRATA_SKIP__"); if (AVR_HAVE_JMP_CALL) - cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__"); + cpp_define (pfile, "__AVR_ERRATA_SKIP_JMP_CALL__"); } if (TARGET_RMW) cpp_define (pfile, "__AVR_ISA_RMW__"); cpp_define_formatted (pfile, "__AVR_SFR_OFFSET__=0x%x", - avr_arch->sfr_offset); + avr_arch->sfr_offset); #ifdef WITH_AVRLIBC cpp_define (pfile, "__WITH_AVRLIBC__"); @@ -478,17 +478,17 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) if (lang_GNU_C ()) { for (int i = 0; i < ADDR_SPACE_COUNT; i++) - if (!ADDR_SPACE_GENERIC_P (i) - /* Only supply __FLASH macro if the address space is reasonable - for this target. The address space qualifier itself is still - supported, but using it will throw an error. */ - && avr_addr_space_supported_p ((addr_space_t) i)) - { - const char *name = avr_addrspace[i].name; - char *Name = (char*) alloca (1 + strlen (name)); - - cpp_define (pfile, avr_toupper (Name, name)); - } + if (!ADDR_SPACE_GENERIC_P (i) + /* Only supply __FLASH macro if the address space is reasonable + for this target. The address space qualifier itself is still + supported, but using it will throw an error. */ + && avr_addr_space_supported_p ((addr_space_t) i)) + { + const char *name = avr_addrspace[i].name; + char *Name = (char*) alloca (1 + strlen (name)); + + cpp_define (pfile, avr_toupper (Name, name)); + } } /* Define builtin macros so that the user can easily query whether or @@ -502,8 +502,8 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) /* Builtin macros for the __int24 and __uint24 type. */ cpp_define_formatted (pfile, "__INT24_MAX__=8388607%s", - INT_TYPE_SIZE == 8 ? "LL" : "L"); + INT_TYPE_SIZE == 8 ? "LL" : "L"); cpp_define (pfile, "__INT24_MIN__=(-__INT24_MAX__-1)"); cpp_define_formatted (pfile, "__UINT24_MAX__=16777215%s", - INT_TYPE_SIZE == 8 ? "ULL" : "UL"); + INT_TYPE_SIZE == 8 ? "ULL" : "UL"); }