assert.h File Reference

Assertions. More...

Go to the source code of this file.

Defines

#define ASSERTING   1
#define assert(condition)
 Assert a condition at run-time.
#define linker_assert(condition, error_symbol)
 Assert a condition at link-time.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
int __attribute__ ((format(printf, 1, 2))) assert_printf(const char *fmt
 printf() for assertions
int asm ("printf")


Detailed Description

Assertions.

This file provides two assertion macros: assert() (for run-time assertions) and linker_assert() (for link-time assertions).

Definition in file assert.h.


Define Documentation

#define ASSERTING   1

Definition at line 18 of file assert.h.

#define assert ( condition   ) 

Value:

do {                                                                 \
                if ( ASSERTING && ! (condition) ) {                          \
                        assert_printf ( "assert(%s) failed at %s line %d\n", \
                                        #condition, __FILE__, __LINE__ );    \
                }                                                            \
        } while ( 0 )
Assert a condition at run-time.

If the condition is not true, a debug message will be printed. Assertions only take effect in debug-enabled builds (see DBG()).

Todo:
Make an assertion failure abort the program

Definition at line 43 of file assert.h.

Referenced by _print_label(), a3c90x_internal_ReadEeprom(), aes_decrypt(), aes_encrypt(), aoe_send_command(), apply_iscsi_string_setting(), arbel_cmd(), arbel_complete(), ath5k_handle_rx(), base64_encode(), bios_handle_ed(), bzimage_exec(), cbc_decrypt(), cbc_encrypt(), cbc_xor(), chap_init(), chap_respond(), chap_update(), com32_exec(), comboot_exec(), comboot_fetch_kernel(), copy_encap_settings(), dhcp_create_request(), dns_xfer_deliver_raw(), efab_fill_rx_queue(), efab_receive(), efab_transmit(), efab_transmit_done(), efi_handle_ed(), efi_snp_driver_start(), efi_snp_set_mode(), efi_urealloc(), efi_width(), elf_load(), falcon_alloc_special_buffer(), falcon_mdio_read(), falcon_mdio_write(), falcon_spi_rw(), fetch_string_setting_copy(), fetch_uint_setting(), fetchf_hex(), find_smbios_structure(), free_iob(), gdbmach_commit_hwbp(), gdbserial_recv(), gdbudp_ensure_netdev_open(), generic_settings_clear(), guess_int13_geometry(), hermon_alloc_icm(), hermon_cmd(), hermon_complete(), hermon_map_vpm(), hermon_post_send(), hide_umalloc(), http_socket_deliver_iob(), ib_destroy_cq(), ib_destroy_qp(), ib_mi_send(), ib_open(), ib_pull(), ibft_fill_target_chap(), ibft_fill_target_reverse_chap(), image_exec(), image_load(), imgfetch_core_exec(), imgfill_cmdline(), init_i2c_bit_basher(), init_spi_bit_basher(), insert_delete(), int13_rw_sectors(), int22(), iob_pad(), iob_pull(), iscsi_build_login_request_strings(), iscsi_handle_chap_r_value(), iscsi_open_connection(), iscsi_rx_buffered_data(), iscsi_rx_data_in(), iscsi_scsi_done(), iscsi_socket_deliver_raw(), iscsi_start_command(), iscsi_start_tx(), iscsi_tx_data_out(), iscsi_tx_step(), last_opened_ibdev(), last_opened_netdev(), linda_complete_recv(), linda_complete_send(), linda_ib_epb_mod_reg(), linda_ib_epb_ram_xfer(), linda_post_recv(), linda_post_send(), multiboot_build_module_list(), nbi_process_segments(), ndp_process_advert(), net80211_change_channel(), net80211_mgmt_dequeue(), net80211_prepare_assoc(), net80211_prepare_probe(), net80211_probe_start(), net80211_set_rate_idx(), netdev_tx_complete_err(), nvs_read(), nvs_write(), phantom_clp_cmd(), phantom_crb_access_128m(), phantom_crb_access_2m(), phantom_crb_access_32m(), phantom_dmesg(), phantom_poll(), phantom_probe(), phantom_refill_rx_ring(), phantom_transmit(), pxe_menu_boot(), pxe_udp_deliver_iob(), pxenv_undi_get_information(), pxeparent_call(), rdtsc_ticks_per_sec(), read_smbios_string(), read_smbios_structure(), read_user(), register_settings(), sbft_fill_data(), shuffle(), skge_up(), skge_xmit_frame(), sky2_status_intr(), sky2_tx_complete(), slam_parse_multicast_address(), slam_pull_header(), slam_put_value(), spi_bit_rw(), srp_cmd(), srp_login(), tcp_expired(), tcp_xmit(), threewire_read(), threewire_write(), timer_expired(), tls_cipherstream_deliver_raw(), tls_generate_keys(), tls_newdata_process_header(), tls_set_cipher(), tls_step(), undinet_hook_isr(), undinet_unhook_isr(), and vxge_hw_device_terminate().

#define linker_assert ( condition,
error_symbol   ) 

Value:

if ( ! (condition) ) {                          \
                extern void error_symbol ( void );      \
                error_symbol();                         \
        }
Assert a condition at link-time.

If the condition is not true, the link will fail with an unresolved symbol (error_symbol).

This macro is gPXE-specific. Do not use this macro in code intended to be portable.

Definition at line 61 of file assert.h.

Referenced by aoe_send_command(), arbel_mad(), ata_identify(), hermon_mad(), linda_init_recv(), and linda_post_recv().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

int __attribute__ ( (format(printf, 1, 2))   )  const

printf() for assertions

This function exists so that the assert() macro can expand to printf() calls without dragging the printf() prototype into scope.

As far as the compiler is concerned, assert_printf() and printf() are completely unrelated calls; it's only at the assembly stage that references to the assert_printf symbol are collapsed into references to the printf symbol.

int asm ( "printf"   ) 


Generated on Tue Apr 6 20:01:47 2010 for gPXE by  doxygen 1.5.7.1